summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Herzog <thomas.herzog@mail.com>2018-09-04 17:26:10 +0200
committerGitHub <noreply@github.com>2018-09-04 17:26:10 +0200
commit93a888e81ed7cc1f02d8833273a63ae987c58c04 (patch)
treeda9348b8c607ce28777f30ca8847dab5022e8367
parente8a6c5844ad7d8b0a1000b4173738e3e93f2a11e (diff)
parentfadf2d2afd1f69655599607893f5e6f058964af6 (diff)
Merge pull request #21754 from willnationsdev/fix-script-class-ns
Fix invalid deref in NativeScript script classes
-rw-r--r--modules/gdnative/nativescript/nativescript.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp
index 147e375fe6..3f88fabebd 100644
--- a/modules/gdnative/nativescript/nativescript.cpp
+++ b/modules/gdnative/nativescript/nativescript.cpp
@@ -1585,12 +1585,16 @@ bool NativeScriptLanguage::handles_global_class_type(const String &p_type) const
String NativeScriptLanguage::get_global_class_name(const String &p_path, String *r_base_type, String *r_icon_path) const {
Ref<NativeScript> script = ResourceLoader::load(p_path, "NativeScript");
if (script.is_valid()) {
- *r_base_type = script->get_instance_base_type();
- *r_icon_path = script->get_script_class_icon_path();
+ if (r_base_type)
+ *r_base_type = script->get_instance_base_type();
+ if (r_icon_path)
+ *r_icon_path = script->get_script_class_icon_path();
return script->get_script_class_name();
}
- *r_base_type = String();
- *r_icon_path = String();
+ if (r_base_type)
+ *r_base_type = String();
+ if (r_icon_path)
+ *r_icon_path = String();
return String();
}