From 05b00a14c5081ee4bf362b12839dcbb94df1169a Mon Sep 17 00:00:00 2001 From: h2so5 Date: Wed, 17 Dec 2014 14:01:39 +0900 Subject: String#[] should reject nil index --- src/string.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/string.c') diff --git a/src/string.c b/src/string.c index 1c54ffa72..2b1a27fee 100644 --- a/src/string.c +++ b/src/string.c @@ -781,6 +781,7 @@ num_index: } } default: + if (mrb_nil_p(indx)) mrb_raise(mrb, E_TYPE_ERROR, "can't convert nil into Integer"); idx = mrb_fixnum(indx); goto num_index; } -- cgit v1.2.3