From 4fb7b1ebb052b676562eb957a6d79fe7a4966602 Mon Sep 17 00:00:00 2001 From: LATRio Date: Tue, 28 Sep 2021 19:37:34 +0900 Subject: [PATCH] fix crash in Variant::get_method_default_arguments when wrong type is passed --- core/variant_call.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/variant_call.cpp b/core/variant_call.cpp index b9547928915..12f36bab4e1 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -1438,12 +1438,11 @@ Variant::Type Variant::get_method_return_type(Variant::Type p_type, const String } Vector Variant::get_method_default_arguments(Variant::Type p_type, const StringName &p_method) { + ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, Vector()); const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[p_type]; const Map::Element *E = tf.functions.find(p_method); - if (!E) { - return Vector(); - } + ERR_FAIL_COND_V(!E, Vector()); return E->get().default_args; }