summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ini_load.cpp5
1 files changed, 3 insertions, 2 deletions
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;