summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorh2so5 <[email protected]>2014-12-17 14:01:39 +0900
committerh2so5 <[email protected]>2014-12-17 14:01:39 +0900
commit05b00a14c5081ee4bf362b12839dcbb94df1169a (patch)
treec5bd63ebe420a615bc003058a917bf70f553f866 /src
parent5b203ead1e5f642af7bbb2c1b4d28cf4c5737633 (diff)
downloadmruby-05b00a14c5081ee4bf362b12839dcbb94df1169a.tar.gz
mruby-05b00a14c5081ee4bf362b12839dcbb94df1169a.zip
String#[] should reject nil index
Diffstat (limited to 'src')
-rw-r--r--src/string.c1
1 files changed, 1 insertions, 0 deletions
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;
}