diff options
-rw-r--r-- | engines/titanic/true_talk/tt_node.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/engines/titanic/true_talk/tt_node.cpp b/engines/titanic/true_talk/tt_node.cpp index fece3b8889..565c4664a9 100644 --- a/engines/titanic/true_talk/tt_node.cpp +++ b/engines/titanic/true_talk/tt_node.cpp @@ -58,9 +58,10 @@ void TTnode::deleteSiblings() { _priorP->_nextP = nullptr; // Iterate through the linked chain of nodes, deleting each in turn - for (TTnode *curP = _nextP, *nextP = nullptr; nextP; curP = nextP) { - nextP = curP->_nextP; - delete curP; + while (_nextP) { + TTnode *next = _nextP; + _nextP = next->_nextP; + delete next; } } |