diff --git a/src/script/api/script_list.cpp b/src/script/api/script_list.cpp index 84f2b937cb..a185e0d89c 100644 --- a/src/script/api/script_list.cpp +++ b/src/script/api/script_list.cpp @@ -362,7 +362,12 @@ public: this->has_no_more_items = true; return; } - this->item_iter--; + if (this->item_iter == this->list->items.begin()) { + /* Use 'end' as marker for 'beyond begin' */ + this->item_iter = this->list->items.end(); + } else { + this->item_iter--; + } if (this->item_iter != this->list->items.end()) item_next = (*this->item_iter).first; }