Merge pull request #37318 from ttencate/fix/argument_nulled_37312

Revert "Allow parameters passed to GDScript functions to be nulled"
This commit is contained in:
Rémi Verschelde 2020-04-22 16:09:28 +02:00 committed by GitHub
commit 6aac75afc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 9 deletions

View File

@ -337,15 +337,10 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
} }
if (!argument_types[i].is_type(*p_args[i], true)) { if (!argument_types[i].is_type(*p_args[i], true)) {
if (argument_types[i].is_type(Variant(), true)) { r_err.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
memnew_placement(&stack[i], Variant); r_err.argument = i;
continue; r_err.expected = argument_types[i].kind == GDScriptDataType::BUILTIN ? argument_types[i].builtin_type : Variant::OBJECT;
} else { return Variant();
r_err.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_err.argument = i;
r_err.expected = argument_types[i].kind == GDScriptDataType::BUILTIN ? argument_types[i].builtin_type : Variant::OBJECT;
return Variant();
}
} }
if (argument_types[i].kind == GDScriptDataType::BUILTIN) { if (argument_types[i].kind == GDScriptDataType::BUILTIN) {
Variant arg = Variant::construct(argument_types[i].builtin_type, &p_args[i], 1, r_err); Variant arg = Variant::construct(argument_types[i].builtin_type, &p_args[i], 1, r_err);