diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 3d8424adc..6ba3c5579 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3495,8 +3495,12 @@ void AActor::Tick () } } - // cycle through states, calling action functions at transitions assert (state != NULL); + if (state == NULL) + { + Destroy(); + return; + } if (ObjectFlags & OF_JustSpawned && state->GetNoDelay()) { // For immediately spawned objects with the NoDelay flag set for their @@ -3511,21 +3515,16 @@ void AActor::Tick () tics++; } } + // cycle through states, calling action functions at transitions if (tics != -1) { // [RH] Use tics <= 0 instead of == 0 so that spawnstates // of 0 tics work as expected. - if (tics <= 0) + if (--tics <= 0) { - if (state == NULL) - { - Destroy(); - return; - } if (!SetState(state->GetNextState())) return; // freed itself } - tics--; } else {