summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/string.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/string.c b/src/string.c
index 9a1a6fba1..22a289ade 100644
--- a/src/string.c
+++ b/src/string.c
@@ -2003,12 +2003,12 @@ mrb_str_to_inum(mrb_state *mrb, mrb_value str, mrb_int base, mrb_bool badcheck)
const char *s;
mrb_int len;
- str = mrb_str_to_str(mrb, str);
if (badcheck) {
+ /* Raises if the string contains a null character (the badcheck) */
s = mrb_string_value_cstr(mrb, &str);
}
else {
- s = RSTRING_PTR(str);
+ s = mrb_string_value_ptr(mrb, str);
}
if (s) {
len = RSTRING_LEN(str);