From 3fcdb3198b4dd76705f96fc9f06976f2d9e24257 Mon Sep 17 00:00:00 2001 From: sheepandshepherd Date: Tue, 10 Apr 2018 16:01:13 +0200 Subject: [PATCH] Fix NativeScript property list (cherry picked from commit bc110b37713dc41ec6b364f3d31eaf2b369e06bb) --- modules/gdnative/nativescript/nativescript.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index 772a2a06543..ced60acac47 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -358,14 +358,13 @@ void NativeScript::get_script_property_list(List *p_list) const { NativeScriptDesc *script_data = get_script_desc(); Set existing_properties; + List::Element *original_back = p_list->back(); while (script_data) { - List::Element *insert_position = p_list->front(); - bool insert_before = true; + List::Element *insert_position = original_back; for (OrderedHashMap::Element E = script_data->properties.front(); E; E = E.next()) { if (!existing_properties.has(E.key())) { - insert_position = insert_before ? p_list->insert_before(insert_position, E.get().info) : p_list->insert_after(insert_position, E.get().info); - insert_before = false; + insert_position = p_list->insert_after(insert_position, E.get().info); existing_properties.insert(E.key()); } }