diff options
author | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-01-31 14:06:33 +0100 |
---|---|---|
committer | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-01-31 15:59:37 +0100 |
commit | f4f7e13388b3a37ae0ea1cb69894fb731c1bd1b7 (patch) | |
tree | 007136254e897b97134c546788ac919053fc53f6 /modules/gdscript/gdscript_utility_callable.cpp | |
parent | 9adb7c7d130c6d4eb0e80b92d6eebd71fac3384d (diff) | |
download | redot-engine-f4f7e13388b3a37ae0ea1cb69894fb731c1bd1b7.tar.gz |
Make `GDScriptUtilityCallable` return call error when method is invalid
Diffstat (limited to 'modules/gdscript/gdscript_utility_callable.cpp')
-rw-r--r-- | modules/gdscript/gdscript_utility_callable.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_utility_callable.cpp b/modules/gdscript/gdscript_utility_callable.cpp index 74d2c477c2..7708a18044 100644 --- a/modules/gdscript/gdscript_utility_callable.cpp +++ b/modules/gdscript/gdscript_utility_callable.cpp @@ -83,7 +83,10 @@ ObjectID GDScriptUtilityCallable::get_object() const { void GDScriptUtilityCallable::call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, Callable::CallError &r_call_error) const { switch (type) { case TYPE_INVALID: - ERR_PRINT(vformat(R"(Trying to call invalid utility function "%s".)", function_name)); + r_return_value = vformat(R"(Trying to call invalid utility function "%s".)", function_name); + r_call_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; + r_call_error.argument = 0; + r_call_error.expected = 0; break; case TYPE_GLOBAL: Variant::call_utility_function(function_name, &r_return_value, p_arguments, p_argcount, r_call_error); |