diff --git a/src/scripting/zscript/zcc_compile.cpp b/src/scripting/zscript/zcc_compile.cpp index f24bce20c..d034c51cc 100644 --- a/src/scripting/zscript/zcc_compile.cpp +++ b/src/scripting/zscript/zcc_compile.cpp @@ -2169,13 +2169,6 @@ void ZCCCompiler::CompileStates() } #endif - int count = statedef.AddStates(&state, sl->Frames->GetChars()); - if (count < 0) - { - Error(sl, "Invalid frame character string '%s'", sl->Frames->GetChars()); - count = -count; - } - if (sl->Action != nullptr) { auto code = SetupActionFunction(static_cast(c->Type()), sl->Action); @@ -2184,6 +2177,13 @@ void ZCCCompiler::CompileStates() state.ActionFunc = FunctionBuildList.AddFunction(c->Type(), code, FStringf("%s.StateFunction.%d", c->Type()->TypeName.GetChars(), statedef.GetStateCount()), true); } } + + int count = statedef.AddStates(&state, sl->Frames->GetChars()); + if (count < 0) + { + Error(sl, "Invalid frame character string '%s'", sl->Frames->GetChars()); + count = -count; + } break; } case AST_StateGoto: