Merge pull request #87783 from AThousandShips/utility_err
Make `GDScriptUtilityCallable` return call error when method is invalid
This commit is contained in:
commit
9cfd6dbab2
1 changed files with 4 additions and 1 deletions
|
@ -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 {
|
void GDScriptUtilityCallable::call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, Callable::CallError &r_call_error) const {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TYPE_INVALID:
|
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;
|
break;
|
||||||
case TYPE_GLOBAL:
|
case TYPE_GLOBAL:
|
||||||
Variant::call_utility_function(function_name, &r_return_value, p_arguments, p_argcount, r_call_error);
|
Variant::call_utility_function(function_name, &r_return_value, p_arguments, p_argcount, r_call_error);
|
||||||
|
|
Loading…
Reference in a new issue