diff --git a/lootsheet-simple.js b/lootsheet-simple.js index 43e144c..9575bdb 100644 --- a/lootsheet-simple.js +++ b/lootsheet-simple.js @@ -161,10 +161,15 @@ class LootSheet5eNPC extends dnd5e.applications.actor.ActorSheet5eNPC { } let totalWeight = 0; this.actor.items.contents.forEach((item) => { - let weight = Math.round( - (item.system.quantity * item.system.weight.value * 100) / 100 - ); - totalWeight += isNaN(weight) ? 0 : weight; + try { + let weight = Math.round( + (item.system.quantity * item.system.weight.value * 100) / 100 + ); + totalWeight += isNaN(weight) ? 0 : weight; + } catch (error) { + console.error("An error occurred while calculating weight:", error); + totalWeight += 0; + } }); if (game.settings.get("lootsheet-simple", "includeCurrencyWeight")) { diff --git a/module.json b/module.json index 0fb082d..c31147a 100644 --- a/module.json +++ b/module.json @@ -1,7 +1,7 @@ { "title": "Loot Sheet NPC 5e (Simple Version)", "description": "This module adds an additional NPC sheet which can be used for loot containers such as chests or shopkeepers.", - "version": "12.400.1", + "version": "12.400.2", "esmodules": [ "/lootsheet-simple.js" ],