summaryrefslogtreecommitdiffhomepage
path: root/src/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/string.c')
-rw-r--r--src/string.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/string.c b/src/string.c
index 1c54ffa72..aa26b261c 100644
--- a/src/string.c
+++ b/src/string.c
@@ -781,6 +781,10 @@ num_index:
}
}
default:
+ indx = mrb_Integer(mrb, indx);
+ if (mrb_nil_p(indx)) {
+ mrb_raise(mrb, E_TYPE_ERROR, "can't convert to Fixnum");
+ }
idx = mrb_fixnum(indx);
goto num_index;
}