From af8a40e554c6025e9cc166bbee7829f4353f6b50 Mon Sep 17 00:00:00 2001 From: Ramesh Ravone Date: Sat, 22 Jul 2017 06:05:59 +0530 Subject: [PATCH] gdnative bug fix in get (return null check) --- modules/gdnative/gdnative.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp index 93e13850ac2..214164ef891 100644 --- a/modules/gdnative/gdnative.cpp +++ b/modules/gdnative/gdnative.cpp @@ -876,9 +876,12 @@ bool GDNativeInstance::get(const StringName &p_name, Variant &r_ret) const { const Variant *args[1] = { &name }; godot_variant result = E->get().method.method((godot_object *)owner, E->get().method.method_data, userdata, 1, (godot_variant **)args); - r_ret = *(Variant *)&result; + if (((Variant *)&result)->get_type() != Variant::NIL) { + r_ret = *(Variant *)&result; + godot_variant_destroy(&result); + return true; + } godot_variant_destroy(&result); - return true; } return false;