flamewave000 / dragonflagon-fvtt

DragonFlagon FoundryVTT Modules
BSD 3-Clause "New" or "Revised" License
64 stars 62 forks source link

DF Scene Enhancements: Journal link may crash on bad collections #383

Open flamewave000 opened 2 years ago

flamewave000 commented 2 years ago

https://discord.com/channels/170995199584108546/670336046164213761/994698615106838639

df-scene-journal.ts:69 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'get')
[Detected 1 package: df-scene-enhance]
    at HTMLAnchorElement._onClickContentLink (df-scene-journal.ts:69:54)
    at HTMLBodyElement.dispatch (jquery.min.js:2:43064)
    at v.handle (jquery.min.js:2:41048)
_onClickContentLink    @    df-scene-journal.ts:69
dispatch    @    jquery.min.js:2
v.handle    @    jquery.min.js:2

Need to check if the returned collection is valid before trying to get the document from it. Likely case, the link has a collection ID but that collection no longer exists, or the ID is bad.