From: Yukihiro "Matz" Matsumoto Date: Mon, 28 Apr 2014 04:34:14 +0000 (+0900) Subject: should care about the case that given arguments are less then mandatory formal argume... X-Git-Tag: 1.1.0~487 X-Git-Url: https://repo.or.cz/mruby.git/commitdiff_plain/220f3124b9bd7a993e78b5832d0501209236487f should care about the case that given arguments are less then mandatory formal arguments and optional arguments exist; close #2144 --- diff --git a/src/vm.c b/src/vm.c index df8fe934b..b175ef42f 100644 --- a/src/vm.c +++ b/src/vm.c @@ -1303,7 +1303,7 @@ RETRY_TRY_BLOCK: if (r) { regs[m1+o+1] = mrb_ary_new_capa(mrb, 0); } - if (o == 0) pc++; + if (o == 0 || argc < m1+m2) pc++; else pc += argc - m1 - m2 + 1; }