diff --git a/src/dthinker.cpp b/src/dthinker.cpp index fd20a4e79..11ba54dbc 100644 --- a/src/dthinker.cpp +++ b/src/dthinker.cpp @@ -675,6 +675,9 @@ DThinker *FThinkerIterator::Next (bool exact) { return thinker; } + // This can actually happen when a Destroy call on 'thinker' happens to destroy 'm_CurrThinker'. + // In that case there is no chance to recover, we have to terminate the iteration of this list. + if (m_CurrThinker == nullptr) break; } } if ((m_SearchingFresh = !m_SearchingFresh))