diff --git a/src/module/sheets/advantageSheet.mjs b/src/module/sheets/advantageSheet.mjs index 5215a22f..43ecab3b 100644 --- a/src/module/sheets/advantageSheet.mjs +++ b/src/module/sheets/advantageSheet.mjs @@ -293,7 +293,7 @@ export class AdvantageSheet extends HandlebarsApplicationMixin(DocumentSheetV2) _onRender(context, options) { if (this._selectedVariant == null) { - this._selectedVariant = this.document.system.auswahl[0].name + this._selectedVariant = this.document.system.auswahl?.[0]?.name ?? "" this._currentSelectedVariant = this.document.system.auswahl?.find(p => p.name === this._selectedVariant) this._currentSelectedVariantIndex = this.document.system.auswahl?.findIndex(p => p.name === this._selectedVariant) } diff --git a/src/module/xml-import/xml-import.mjs b/src/module/xml-import/xml-import.mjs index 8401a4ef..b0e3e734 100644 --- a/src/module/xml-import/xml-import.mjs +++ b/src/module/xml-import/xml-import.mjs @@ -339,7 +339,7 @@ export class XmlImport { async #addSkillFromCompendiumByNameToActor(talentName, taw, actor, combatStatistics, attributes) { const compendiumOfSkills = game.packs.get('DSA_4-1.Skills'); - const talentId = compendiumOfSkills.index.find(skill => skill.name === talentName) + const talentId = compendiumOfSkills.index.find(skill => skill.name.trim() === talentName.trim()) if (talentId) { const talent = await compendiumOfSkills.getDocument(talentId._id); @@ -368,7 +368,7 @@ export class XmlImport { async #addAdvantageFromCompendiumByNameToActor(advantageName, advantageValue, actor) { const compendiumOfAdvantages = game.packs.get('DSA_4-1.Advantage'); - const advantageId = compendiumOfAdvantages.index.find(skill => skill.name === advantageName) + const advantageId = compendiumOfAdvantages.index.find(skill => skill.name.trim() === advantageName.trim()) if (advantageId) { const advantage = await compendiumOfAdvantages.getDocument(advantageId._id); @@ -385,7 +385,7 @@ export class XmlImport { async #addSpellsFromCompendiumByNameToActor(spellName, zfw, representation, hauszauber, actor) { const compendiumOfSpells = game.packs.get('DSA_4-1.Spells') const SCREAMING_NAME = spellName.toUpperCase() - const spellId = compendiumOfSpells.index.find(spell => spell.name === SCREAMING_NAME) + const spellId = compendiumOfSpells.index.find(spell => spell.name.trim() === SCREAMING_NAME.trim()) if (spellId) { const spell = await compendiumOfSpells.getDocument(spellId._id); @@ -403,7 +403,7 @@ export class XmlImport { async #addLiturgiesFromCompendiumByNameToActor(liturgyName, actor) { const compendiumOfLiturgies = game.packs.get('DSA_4-1.Liturgies'); const liturgyId = compendiumOfLiturgies.index.find(liturgy => { - return liturgy.name === LiturgyData.lookupAlias(liturgyName.split(" (")[0]) + return liturgy.name.trim() === LiturgyData.lookupAlias(liturgyName.split(" (")[0]).trim() }) if (liturgyId) {