summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
Diffstat (limited to 'object.c')
-rw-r--r--object.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/object.c b/object.c
index d0c0e34f82..0d99c6db47 100644
--- a/object.c
+++ b/object.c
@@ -3138,6 +3138,9 @@ rb_convert_to_integer(VALUE val, int base, int raise_exception)
tmp = rb_protect(rb_check_to_int, val, NULL);
if (RB_INTEGER_TYPE_P(tmp)) return tmp;
rb_set_errinfo(Qnil);
+ if (!NIL_P(tmp = rb_check_string_type(val))) {
+ return rb_str_convert_to_inum(tmp, base, TRUE, raise_exception);
+ }
if (!raise_exception) {
VALUE result = rb_protect(rb_check_to_i, val, NULL);