diff --git a/src/g_shared/a_action.cpp b/src/g_shared/a_action.cpp index 627c7323d..a15628cb4 100644 --- a/src/g_shared/a_action.cpp +++ b/src/g_shared/a_action.cpp @@ -125,16 +125,19 @@ DCorpsePointer::DCorpsePointer (AActor *ptr) TThinkerIterator iterator (STAT_CORPSEPOINTER); DCorpsePointer *first = iterator.Next (); - if (first != this) + if (first != nullptr) { - if (first->Count >= (uint32_t)sv_corpsequeuesize) + if (first != this) { - DCorpsePointer *next = iterator.Next (); - first->Destroy (); - first = next; + if (first->Count >= (uint32_t)sv_corpsequeuesize) + { + DCorpsePointer *next = iterator.Next(); + first->Destroy(); + first = next; + } } + ++first->Count; } - ++first->Count; } void DCorpsePointer::OnDestroy ()