From 09b132728c23f5c3aeae9f8dd652d4f667d2ea9f Mon Sep 17 00:00:00 2001 From: Robin Sommer Date: Wed, 13 Apr 2022 16:13:23 +0200 Subject: [PATCH] Fix another crash during dictionary iteration. Closes #2017. --- src/Dict.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Dict.cc b/src/Dict.cc index c9d3fab0df..a327b51ad5 100644 --- a/src/Dict.cc +++ b/src/Dict.cc @@ -1499,6 +1499,14 @@ void Dictionary::AdjustOnRemove(RobustDictIterator* c, const detail::DictEntry& // if not already the end of the dictionary, adjust next to a valid one. if ( c->next < Capacity() && table[c->next].Empty() ) c->next = Next(c->next); + + if ( c->curr == entry ) + { + if ( c->next >= 0 && c->next < Capacity() && ! table[c->next].Empty() ) + c->curr = table[c->next]; + else + c->curr = detail::DictEntry(nullptr); // -> c == end_robust() + } } ///////////////////////////////////////////////////////////////////////////////////////////////////