From 96788850d37baca9325d47235fa4146537eea8c0 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 10 Jan 2017 00:38:08 +0100 Subject: [PATCH] - added a workaround for a crashing condition in FThinkerIterator. It can actually happen that the thinker chain gets broken if an actor being iterated happens to destroy the immediately following actor in the chain as well. In that case both actors lose their chain links and the iterator cannot advance any further, the only solution to avoid a crash is to terminate the iteration of the current list. --- src/dthinker.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/dthinker.cpp b/src/dthinker.cpp index fd20a4e79a..11ba54dbc9 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))