summaryrefslogtreecommitdiff
path: root/modules/gdnative/gdnative.cpp
diff options
context:
space:
mode:
authorThomas Herzog <thomas.herzog@mail.com>2017-07-22 21:06:16 +0200
committerGitHub <noreply@github.com>2017-07-22 21:06:16 +0200
commitc74a3275dcce579287d954451d225742581bbb42 (patch)
tree10b018bcb6986bf8688f53ccd7118af042ccbcd0 /modules/gdnative/gdnative.cpp
parent772485cdb3a0b0003da6e174157680559fa2a59e (diff)
parentaf8a40e554c6025e9cc166bbee7829f4353f6b50 (diff)
Merge pull request #9757 from RameshRavone/patch-1
gdnative bug fix in get (return null check)
Diffstat (limited to 'modules/gdnative/gdnative.cpp')
-rw-r--r--modules/gdnative/gdnative.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index 93e13850ac..214164ef89 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;