From 3e6b4f02855cefc663407c61256338022f906381 Mon Sep 17 00:00:00 2001 From: Joe Spandrusyszyn Date: Fri, 14 Jan 2022 17:13:30 -0500 Subject: [PATCH] Increased support level to v9; fixed exception while the canvas is initializing --- module/module.json | 4 ++-- module/scripts/utils.js | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/module/module.json b/module/module.json index f0e6f4d..f8ce1dd 100644 --- a/module/module.json +++ b/module/module.json @@ -6,7 +6,7 @@ "library": "false", "manifestPlusVersion": "1.2.0", "minimumCoreVersion": "0.8.5", - "compatibleCoreVersion": "0.8.9", + "compatibleCoreVersion": "9", "type": "module", "author": "Joe Spandrusyszyn (illandril)", "authors": [ @@ -64,4 +64,4 @@ "url": "https://github.com/illandril/FoundryVTT-chat-enhancements/raw/master/screenshots/example-preview.png" } ] -} \ No newline at end of file +} diff --git a/module/scripts/utils.js b/module/scripts/utils.js index acfc086..d4bf8c0 100644 --- a/module/scripts/utils.js +++ b/module/scripts/utils.js @@ -1,3 +1,5 @@ +import { log } from './module.js'; + function getThisSceneTokenObj(speaker) { let token = getTokenObj(speaker.token); if (!token) { @@ -21,6 +23,10 @@ function getThisSceneTokenObjForActor(actorID) { } function getTokenObj(id) { + if(!canvas.ready) { + log.info(`getTokenObj(${id}) bailed - canvas is not ready yet`); + return undefined; + } return canvas.tokens.get(id); }