mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 12:12:28 +00:00
Merge pull request #68065 from zCubed3/fix_min_max_crash
`GDScriptAnalyzer` Fix math utilities crashing when invalid args are passed
This commit is contained in:
commit
213ba46672
@ -2425,9 +2425,15 @@ void GDScriptAnalyzer::reduce_call(GDScriptParser::CallNode *p_call, bool p_is_a
|
||||
|
||||
switch (err.error) {
|
||||
case Callable::CallError::CALL_ERROR_INVALID_ARGUMENT: {
|
||||
PropertyInfo wrong_arg = function_info.arguments[err.argument];
|
||||
String expected_type_name;
|
||||
if (err.argument < function_info.arguments.size()) {
|
||||
expected_type_name = type_from_property(function_info.arguments[err.argument]).to_string();
|
||||
} else {
|
||||
expected_type_name = Variant::get_type_name((Variant::Type)err.expected);
|
||||
}
|
||||
|
||||
push_error(vformat(R"*(Invalid argument for "%s()" function: argument %d should be %s but is %s.)*", function_name, err.argument + 1,
|
||||
type_from_property(wrong_arg).to_string(), p_call->arguments[err.argument]->get_datatype().to_string()),
|
||||
expected_type_name, p_call->arguments[err.argument]->get_datatype().to_string()),
|
||||
p_call->arguments[err.argument]);
|
||||
} break;
|
||||
case Callable::CallError::CALL_ERROR_INVALID_METHOD:
|
||||
|
Loading…
Reference in New Issue
Block a user