ultrakorne / better-rolltables

Module for FoundryVTT to improve rolltables
MIT License
32 stars 29 forks source link

[BUG] Rolling on LootTable which uses nested LootTables intermittently fails with error #169

Open PlasticMohawk opened 2 years ago

PlasticMohawk commented 2 years ago

This is in Foundry v9. I also have LootSheetNpc5E installed despite the compatibility warning. However, the issue seems to exist even with that other module disabled.

I have a Better RollTable set up as a Loot Table. This table uses other, nested Loot Tables.

Intermittently, rolling on this table using the following macro fails, with the error below.

Macro:

const table = game.tables.getName("Treasure Hoard - CR 0-4");
game.betterTables.generateChatLoot(table);

Chrome console error:

loot-creator.js:130 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'data')
[Detected 1 package: better-rolltables]
    at LootCreator.buildItemData (modules/better-rolltables/scripts/loot/loot-creator.js:130)
    at async LootChatCard.findOrCreateItems (modules/better-rolltables/scripts/loot/loot-chat-card.js:39)
    at async LootChatCard.prepareCharCart (modules/better-rolltables/scripts/loot/loot-chat-card.js:111)
    at async LootChatCard.createChatCard (modules/better-rolltables/scripts/loot/loot-chat-card.js:151)
    at async BetterTables.generateChatLoot (modules/better-rolltables/scripts/better-tables.js:94)

When this happens, no ChatMessage containing loot enters chat. (When there is a successful table roll/ChatMessage creation, I'm not able to interact with the items in the ChatMessage. There are no console errors when I, for example, click on one of the items.

Screen Shot 2022-01-07 at 12 56 20