diff options
author | Marcelo Fernandez <marcelofg55@gmail.com> | 2018-07-22 17:41:50 -0300 |
---|---|---|
committer | Marcelo Fernandez <marcelofg55@gmail.com> | 2018-07-25 10:58:15 -0300 |
commit | 77f3c0b4958785c06eead36bdad79b778c5be495 (patch) | |
tree | ecc22689d1981c9fc6b83d7960afc8e4bc85a2ea /modules/gdnative/nativescript | |
parent | 4b549faaab40f09756b644d4ad4d9d63e3b5e70c (diff) |
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; |