summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/gdscript/gdscript_functions.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp
index 0199af642f..85a5d86ca0 100644
--- a/modules/gdscript/gdscript_functions.cpp
+++ b/modules/gdscript/gdscript_functions.cpp
@@ -1199,6 +1199,11 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
}
r_ret = gdscr->_new(nullptr, -1 /*skip initializer*/, r_error);
+ if (r_error.error != Callable::CallError::CALL_OK) {
+ r_ret = Variant();
+ return;
+ }
+
GDScriptInstance *ins = static_cast<GDScriptInstance *>(static_cast<Object *>(r_ret)->get_script_instance());
Ref<GDScript> gd_ref = ins->get_script();