diff --git a/script.lua b/script.lua index 96df85ac0..e4386742a 100644 --- a/script.lua +++ b/script.lua @@ -3783,14 +3783,17 @@ function handleDoSetup(obj, color) end if not json.setupComplete then local spiritName = obj.getVar("spiritName") - local spiritColor = getSpiritColor({name = spiritName}) - if color == spiritColor then - local success = obj.call("doSetup", {color=color}) - json.setupComplete = success - obj.script_state = JSON.encode(json) - else - Player[color].broadcast("You have not picked "..spiritName.."!", Color.Red) + if spiritName then + local spiritColor = getSpiritColor({name = spiritName}) + if color ~= spiritColor then + Player[color].broadcast("You have not picked "..spiritName.."!", Color.Red) + return + end end + + local success = obj.call("doSetup", {color=color}) + json.setupComplete = success + obj.script_state = JSON.encode(json) end end