diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-02-06 14:12:19 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-02-08 10:08:34 +0100 |
commit | 317cd0b19a284f9a7296fcb4e06d9b2362da8c85 (patch) | |
tree | bdc9052230c16a9c6dcab330e84f51c8b62658e7 /modules/gdnative | |
parent | 0154ce2c8d66528d617e10b139640fd4c4405c6b (diff) |
Refactor some object type checking code with `cast_to`
Less stringly typed logic, and less String allocations and comparisons.
Diffstat (limited to 'modules/gdnative')
-rw-r--r-- | modules/gdnative/nativescript/nativescript.cpp | 2 | ||||
-rw-r--r-- | modules/gdnative/pluginscript/pluginscript_script.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index be304a43f0..5d5414c694 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -766,7 +766,7 @@ Variant NativeScriptInstance::call(const StringName &p_method, const Variant **p void NativeScriptInstance::notification(int p_notification) { #ifdef DEBUG_ENABLED if (p_notification == MainLoop::NOTIFICATION_CRASH) { - if (current_method_call != StringName("")) { + if (current_method_call != StringName()) { ERR_PRINT("NativeScriptInstance detected crash on method: " + current_method_call); current_method_call = ""; } diff --git a/modules/gdnative/pluginscript/pluginscript_script.cpp b/modules/gdnative/pluginscript/pluginscript_script.cpp index 71ab8ef0a2..ec3c9eb4ff 100644 --- a/modules/gdnative/pluginscript/pluginscript_script.cpp +++ b/modules/gdnative/pluginscript/pluginscript_script.cpp @@ -93,7 +93,7 @@ Variant PluginScript::_new(const Variant **p_args, int p_argcount, Callable::Cal REF ref; Object *owner = nullptr; - if (get_instance_base_type() == "") { + if (get_instance_base_type() == StringName()) { owner = memnew(RefCounted); } else { owner = ClassDB::instantiate(get_instance_base_type()); |