summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLyuma <xn.lyuma@gmail.com>2020-12-21 20:13:05 -0800
committerLyuma <xn.lyuma@gmail.com>2020-12-21 20:15:29 -0800
commit0d4b750051ac8e31349cb71c31f98a93acf317bb (patch)
tree1d5f626a4c0be99a031bb0af6384cafa8abe5b5e
parent2cbc0b641a0d58a88592d52d86634ca2d40da9e4 (diff)
Fix crash when iterating through empty dictionary.
-rw-r--r--modules/gdscript/gdscript_vm.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_vm.cpp b/modules/gdscript/gdscript_vm.cpp
index b8e1791467..4f50ed8271 100644
--- a/modules/gdscript/gdscript_vm.cpp
+++ b/modules/gdscript/gdscript_vm.cpp
@@ -2306,10 +2306,10 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
Dictionary *dict = VariantInternal::get_dictionary(container);
const Variant *next = dict->next(nullptr);
- *counter = *next;
if (!dict->empty()) {
GET_INSTRUCTION_ARG(iterator, 2);
+ *counter = *next;
*iterator = *next;
// Skip regular iterate.