Fix expected argument count for Callable call errors

This commit is contained in:
Danil Alexeev 2023-09-29 19:19:46 +03:00
parent 19890614c6
commit aff767ef07
No known key found for this signature in database
GPG key ID: 124453E157DA8DC7
15 changed files with 70 additions and 77 deletions

View file

@ -50,14 +50,14 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
}
int pc = E.param_types.size();
if (pc > p_argcount) {
if (p_argcount < pc) {
r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
r_error.argument = pc;
r_error.expected = pc;
continue;
}
if (pc < p_argcount) {
if (p_argcount > pc) {
r_error.error = Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS;
r_error.argument = pc;
r_error.expected = pc;
continue;
}
uint32_t *ptypes = E.param_types.ptrw();