diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp index 58161d6f532..2f98e600814 100644 --- a/modules/gdscript/gdscript_functions.cpp +++ b/modules/gdscript/gdscript_functions.cpp @@ -1200,6 +1200,11 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ r_ret = gdscr->_new(nullptr, 0, r_error); + if (r_error.error != Callable::CallError::CALL_OK) { + r_ret = Variant(); + return; + } + GDScriptInstance *ins = static_cast(static_cast(r_ret)->get_script_instance()); Ref gd_ref = ins->get_script();