diff --git a/src/string.c b/src/string.c index 2ab45e289..754a3b5ca 100644 --- a/src/string.c +++ b/src/string.c @@ -1984,10 +1984,9 @@ mrb_str_rindex(mrb_state *mrb, mrb_value str) { mrb_value sub; mrb_int pos; - int argc = mrb_get_args(mrb, "S|i", &sub, &pos); mrb_int len = RSTRING_CHAR_LEN(str); - if (argc == 1) { + if (mrb_get_args(mrb, "S|i", &sub, &pos) == 1) { pos = len; } else {