fix crash in Variant::get_method_default_arguments when wrong type is passed

This commit is contained in:
LATRio 2021-09-28 19:37:34 +09:00
parent dbe0e4613a
commit 4fb7b1ebb0

View file

@ -1438,12 +1438,11 @@ Variant::Type Variant::get_method_return_type(Variant::Type p_type, const String
}
Vector<Variant> Variant::get_method_default_arguments(Variant::Type p_type, const StringName &p_method) {
ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, Vector<Variant>());
const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[p_type];
const Map<StringName, _VariantCall::FuncData>::Element *E = tf.functions.find(p_method);
if (!E) {
return Vector<Variant>();
}
ERR_FAIL_COND_V(!E, Vector<Variant>());
return E->get().default_args;
}