diff options
| author | Rémi Verschelde | 2018-01-15 20:18:50 +0100 |
|---|---|---|
| committer | GitHub | 2018-01-15 20:18:50 +0100 |
| commit | 700a1a90964210ea54bb7cb03dc8697b1efb531a (patch) | |
| tree | 480c2dde531fc4acb52f21115b270d9174afaf28 /modules/gdnative/nativescript/nativescript.cpp | |
| parent | 089dcc69598d869a4d92af3bff650c7271f9c33e (diff) | |
| parent | d56bcc38ac69a63715c30a6fcd06a1e763704251 (diff) | |
| download | godot-700a1a90964210ea54bb7cb03dc8697b1efb531a.tar.gz godot-700a1a90964210ea54bb7cb03dc8697b1efb531a.tar.zst godot-700a1a90964210ea54bb7cb03dc8697b1efb531a.zip | |
Merge pull request #15724 from karroffel/gdnative-fix-some-crashes
[GDNative] fix two crashes with NativeScript
Diffstat (limited to 'modules/gdnative/nativescript/nativescript.cpp')
| -rw-r--r-- | modules/gdnative/nativescript/nativescript.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index f45217d03..cff5d9c9b 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -398,6 +398,11 @@ Variant NativeScript::_new(const Variant **p_args, int p_argcount, Variant::Call owner = memnew(Reference); } + if (!owner) { + r_error.error = Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL; + return Variant(); + } + Reference *r = Object::cast_to<Reference>(owner); if (r) { ref = REF(r); @@ -793,7 +798,7 @@ NativeScriptLanguage *NativeScriptLanguage::singleton; void NativeScriptLanguage::_unload_stuff(bool p_reload) { for (Map<String, Map<StringName, NativeScriptDesc> >::Element *L = library_classes.front(); L; L = L->next()) { - if (p_reload && !library_gdnatives[L->key()]->get_library()->is_reloadable()) { + if (p_reload && library_gdnatives[L->key()].is_valid() && !library_gdnatives[L->key()]->get_library()->is_reloadable()) { continue; } |
