From 17bc2b1dc29680585f90b995de9a1b2ee4fbe1d6 Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Tue, 19 Nov 2024 20:57:28 +0100 Subject: [PATCH] nil handling --- src/core/Global.ttslua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index ea516c61..6b618928 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -2905,15 +2905,19 @@ end function updateTokenTransform(card) for _, tokenData in ipairs(cardTokens[card] or {}) do - tokenData.token.setPosition(card.positionToWorld(tokenData.localPos)) - tokenData.token.setRotation(card.getRotation() + tokenData.localRot) - tokenData.token.locked = true + if tokenData.token ~= nil then + tokenData.token.setPosition(card.positionToWorld(tokenData.localPos)) + tokenData.token.setRotation(card.getRotation() + tokenData.localRot) + tokenData.token.locked = true + end end end function stopTokenTransformUpdating(card) for _, tokenData in ipairs(cardTokens[card] or {}) do - tokenData.token.locked = false + if tokenData.token ~= nil then + tokenData.token.locked = false + end end cardTokens[card] = nil card.use_hands = true