jtracey / journal-backlinks

A module for Foundry VTT that links entities (journal entries, actors and items) that reference each other
MIT License
4 stars 3 forks source link

Console errors with Monster Blocks #4

Closed vexofp closed 2 years ago

vexofp commented 2 years ago

When using a sheet such as Monster Blocks that might not always include the actor's biography, Journal Backlinks generates annoying console errors like this:

foundry.js:319 TypeError: Cannot read properties of undefined (reading 'length')
[Detected 1 package: journal-backlinks]
    at JournalLink.includeLinks (journallink.js:151:21)
    at JournalLink.includeActorLinks (journallink.js:137:14)
    at Function._call (foundry.js:294:14)
    at Function.call (foundry.js:279:33)
    at MonsterBlock5e._render (foundry.js:3117:13)
    at async MonsterBlock5e._render (foundry.js:3764:5)

This occurs because getElementToModify() is not finding the element (because it does not exist) and we are not handling that case.