From ab601115a906a576d4af53509a8ee14e455f6a3f Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Sat, 17 Jul 2021 17:26:50 +0200 Subject: Fix 75b6051b: removing items from the ini could leave the group in a bad state (#9445) --- src/ini_load.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ini_load.cpp b/src/ini_load.cpp index 0663ef1e4..06d6efb33 100644 --- a/src/ini_load.cpp +++ b/src/ini_load.cpp @@ -112,8 +112,9 @@ void IniGroup::RemoveItem(const std::string &name) if (item->name != name) continue; *prev = item->next; - if (this->last_item == &this->item) { - this->last_item = &item->next; + /* "last_item" is a pointer to the "real-last-item"->next. */ + if (this->last_item == &item->next) { + this->last_item = prev; } item->next = nullptr; -- cgit v1.2.3-70-g09d2