Skip to content

Commit

Permalink
Fix crash from tokens with null reference
Browse files Browse the repository at this point in the history
  • Loading branch information
rrgeorge committed Jan 31, 2022
1 parent 51279c7 commit 7a6831a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ async function connectGameLog(gameId,userId,campaignName) {
let conditions = f.conditions.map(c=>`i-condition-white-${c.name.toLowerCase()}`)
let senses = f.senses.map(s=>`${s.name} ${s.distance}`)
let exhaustion = f.conditions.find(c=>c.name.toLowerCase()=="exhaustion")?.level||0
const token = _eTokens.filter(t=>t.reference.startsWith('/player/')).find(t=>t.name.trim()==f.name.trim())
const token = _eTokens.filter(t=>t.reference?.startsWith('/player/')).find(t=>t.name?.trim()==f.name.trim())
if (token && (token.health != (f.hitPointInfo.current+f.hitPointInfo.temp) || token.hitpoints != f.hitPointInfo.maximum)) {
console.log(`Update ${f.name}`)
const model = {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "encounterlog",
"productName": "EncounterLog",
"version": "2.4.6",
"version": "2.4.7",
"repository": {
"type": "git",
"url": "https://github.com/rrgeorge/encounterlog"
Expand Down

0 comments on commit 7a6831a

Please sign in to comment.