String#[] should reject nil index

This commit is contained in:
h2so5
2014-12-17 14:01:39 +09:00
parent 5b203ead1e
commit 05b00a14c5
2 changed files with 5 additions and 0 deletions
+1
View File
@@ -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;
}