summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/script/api/script_list.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/script/api/script_list.cpp b/src/script/api/script_list.cpp
index 84f2b937c..a185e0d89 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;
}