From 3f6701a8bd72ed65ce814dca33507c8f2a8e278e Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Sat, 8 Jan 2022 10:55:05 +0100 Subject: [PATCH] Berry fix crash when superfluous parameter is sent --- lib/libesp32/berry_mapping/src/be_class_wrapper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libesp32/berry_mapping/src/be_class_wrapper.c b/lib/libesp32/berry_mapping/src/be_class_wrapper.c index 625723ae5..b034df552 100644 --- a/lib/libesp32/berry_mapping/src/be_class_wrapper.c +++ b/lib/libesp32/berry_mapping/src/be_class_wrapper.c @@ -342,7 +342,7 @@ int be_check_arg_type(bvm *vm, int arg_start, int argc, const char * arg_type, i arg_type = NULL; // stop iterations break; } - if (arg_type[arg_idx] == '[' || arg_type[arg_idx] == ']') { // '[' is a marker that following parameters are optional and default to NULL + if (arg_type && (arg_type[arg_idx] == '[' || arg_type[arg_idx] == ']')) { // '[' is a marker that following parameters are optional and default to NULL arg_optional = btrue; arg_idx++; }