Describe the bug
When applying a condition with Out to Chat option enabled, and that actor has no current chat entries (new actor or if chat has been cleared), it does not generate the chat entry & error is generated. If the actor has a chat entry, then this works as expected.
To Reproduce
Steps to reproduce the behavior:
Make sure Output to Chat option is enabled in the Module settings.
Create a condition and set its option to Output to Chat.
Create a token from an actor.
Clear the chat log.
Apply the condittion on the token.
No Chat for the condition is created & shows following error:
condition-lab-triggler.js:620 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'timestamp')
at EnhancedConditions.outputChatMessage (condition-lab-triggler.js:620:54)
at EnhancedConditions._processActiveEffectChange (condition-lab-triggler.js:499:40)
at EnhancedConditions._onDeleteActiveEffect (condition-lab-triggler.js:355:22)
at Object.fn (condition-lab-triggler.js:4491:21)
at #call (foundry.js:730:20)
at Hooks.callAll (foundry.js:687:17)
at ClientDatabaseBackend.callback (foundry.js:13837:13)
at foundry.js:13812:43
at Array.map ()
at #handleDeleteDocuments (foundry.js:13812:33)
at async ActiveEffect.deleteDocuments (commons.js:8046:23)
at async EnhancedConditions.removeCondition (condition-lab-triggler.js:1687:4)
at async Triggler._executeTrigger (condition-lab-triggler.js:1980:4)
at async Triggler._processUpdate (condition-lab-triggler.js:2192:5)
Expected behavior
Chat log to be generated for the applied condition.
Screenshots
Environment Info (please complete the following information):
Foundry Version: 11.315
Game System / Version: Star Wars FFG 1.806
CLT Version: 1.5.2
Browser: Google Chrome
OS: Windows 11
Additional context
If you generate a chat entry for that token/actor (like a dice roll or comment), then this function works correctly and generates the expected chat update:
Describe the bug When applying a condition with Out to Chat option enabled, and that actor has no current chat entries (new actor or if chat has been cleared), it does not generate the chat entry & error is generated. If the actor has a chat entry, then this works as expected.
To Reproduce Steps to reproduce the behavior:
condition-lab-triggler.js:620 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'timestamp') at EnhancedConditions.outputChatMessage (condition-lab-triggler.js:620:54) at EnhancedConditions._processActiveEffectChange (condition-lab-triggler.js:499:40) at EnhancedConditions._onDeleteActiveEffect (condition-lab-triggler.js:355:22) at Object.fn (condition-lab-triggler.js:4491:21) at #call (foundry.js:730:20) at Hooks.callAll (foundry.js:687:17) at ClientDatabaseBackend.callback (foundry.js:13837:13) at foundry.js:13812:43 at Array.map ()
at #handleDeleteDocuments (foundry.js:13812:33)
at async ActiveEffect.deleteDocuments (commons.js:8046:23)
at async EnhancedConditions.removeCondition (condition-lab-triggler.js:1687:4)
at async Triggler._executeTrigger (condition-lab-triggler.js:1980:4)
at async Triggler._processUpdate (condition-lab-triggler.js:2192:5)
Expected behavior Chat log to be generated for the applied condition.
Screenshots
Environment Info (please complete the following information):
Additional context If you generate a chat entry for that token/actor (like a dice roll or comment), then this function works correctly and generates the expected chat update: