Fix bug with deleteing tokens that have been removed

This commit is contained in:
Mitchell McCaffrey
2020-05-31 10:23:45 +10:00
parent 708a8d3790
commit 31cdbbb8dd
2 changed files with 3 additions and 3 deletions

View File

@@ -48,7 +48,7 @@ function MapToken({
const tokenImage = event.target;
const tokenImageRect = tokenImage.getClientRect();
if (token.isVehicle) {
if (token && token.isVehicle) {
// Find all other tokens on the map
const layer = tokenImage.getLayer();
const tokens = layer.find(".token");
@@ -83,7 +83,7 @@ function MapToken({
const tokenImage = event.target;
const mountChanges = {};
if (token.isVehicle) {
if (token && token.isVehicle) {
const layer = tokenImage.getLayer();
const mountedTokens = tokenImage.find(".token");
for (let mountedToken of mountedTokens) {