From 4b0ed58797be2a0f9f26611dfdfa50f38c170d25 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 10 Dec 2020 02:29:11 +0100 Subject: [PATCH] Fix ouverture sort compendium Pas de bonus de case pour les sorts du compendium --- module/item-sort.js | 17 +++++++++-------- templates/item-sort-sheet.html | 2 ++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/module/item-sort.js b/module/item-sort.js index a8f03581..6bff1c59 100644 --- a/module/item-sort.js +++ b/module/item-sort.js @@ -32,8 +32,11 @@ export class RdDItemSort extends Item { /* -------------------------------------------- */ static buildBonusCaseList( caseBonusString, newCase ) { + if (caseBonusString == undefined) { + return []; + } let bonusCaseList = []; - let bonusCaseArray = caseBonusString.split(','); + let bonusCaseArray = caseBonusString == undefined ? [] : caseBonusString.split(','); for( let bonusCase of bonusCaseArray) { let bonusSplit = bonusCase.split(':'); bonusCaseList.push( { case: bonusSplit[0], bonus: bonusSplit[1] } ); @@ -49,14 +52,12 @@ export class RdDItemSort extends Item { * @param {} item */ static getBonusCaseList( data, newCase = false ) { - - let bonusCaseList = []; - // Gestion spéciale case bonus - if ( data.item.type == 'sort') { - bonusCaseList = this.buildBonusCaseList(data.data.bonuscase, newCase ); - } - return bonusCaseList; + // Gestion spéciale case bonus + if ( data.item.type == 'sort') { + return this.buildBonusCaseList(data.data.bonuscase, newCase ); } + return undefined; + } /* -------------------------------------------- */ /** Met à jour les données de formulaire diff --git a/templates/item-sort-sheet.html b/templates/item-sort-sheet.html index 2a81d1c1..8395a7b6 100644 --- a/templates/item-sort-sheet.html +++ b/templates/item-sort-sheet.html @@ -56,6 +56,7 @@ + {{#if owner}} {{#each bonusCaseList as |bcData key|}}
@@ -63,6 +64,7 @@
{{/each}} + {{/if}}