diff options
author | Thomas Herzog <thomas.herzog@mail.com> | 2018-07-25 17:09:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-25 17:09:51 +0200 |
commit | 95d9302248edb3ddf6b08d23084ee928c41546c4 (patch) | |
tree | 30eafef7886da535403d61acf3ad665602a037e6 /modules/gdnative/nativescript | |
parent | 9e16f4a3704b76b3b7c236e29a141b3c33263667 (diff) | |
parent | 77f3c0b4958785c06eead36bdad79b778c5be495 (diff) |
Merge pull request #20370 from marcelofg55/gdnative_crash
Fix possible crash at NativeScript::get_base_script
Diffstat (limited to 'modules/gdnative/nativescript')
-rw-r--r-- | modules/gdnative/nativescript/nativescript.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index 5e093109d5..eb52bede24 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -149,7 +149,10 @@ Ref<Script> NativeScript::get_base_script() const { if (!script_data) return Ref<Script>(); - Ref<NativeScript> ns = Ref<NativeScript>(NSL->create_script()); + NativeScript *script = (NativeScript *)NSL->create_script(); + Ref<NativeScript> ns = Ref<NativeScript>(script); + ERR_FAIL_COND_V(!ns.is_valid(), Ref<Script>()); + ns->set_class_name(script_data->base); ns->set_library(get_library()); return ns; |