From 5a87791b417113ed6c5449413cc63cee82992a07 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 17 Dec 2020 19:42:25 +0100 Subject: [PATCH] =?UTF-8?q?Fix:=20load=20apr=C3=A8s=20restart?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Après restart, on a un Obnject dans les settings, pas une liste => plante la fenêtre --- module/rdd-calendrier.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/module/rdd-calendrier.js b/module/rdd-calendrier.js index e08a0dc4..bd9d0dda 100644 --- a/module/rdd-calendrier.js +++ b/module/rdd-calendrier.js @@ -58,13 +58,17 @@ export class RdDCalendrier extends Application { } // nombre astral if ( game.user.isGM) { - this.listeNombreAstral = duplicate(game.settings.get("foundryvtt-reve-de-dragon", "liste-nombre-astral")); + this.listeNombreAstral = this._loadListNombreAstral(); this.rebuildListeNombreAstral(); // Ensure always up-to-date } console.log(this.calendrier, this.calendrierPos, this.listeNombreAstral); } + _loadListNombreAstral() { + return Object.values(game.settings.get("foundryvtt-reve-de-dragon", "liste-nombre-astral")); + } + /* -------------------------------------------- */ static get defaultOptions() { const options = super.defaultOptions; @@ -114,7 +118,7 @@ export class RdDCalendrier extends Application { /* -------------------------------------------- */ getNombreAstral( index ) { - const liste = this.listeNombreAstral || game.settings.get("foundryvtt-reve-de-dragon", "liste-nombre-astral") + const liste = this.listeNombreAstral || this._loadListNombreAstral(); let astralData = liste.find( (nombreAstral, i) => nombreAstral.index == index ); return astralData.nombreAstral || "N/A"; }