summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/string.c b/string.c
index c57ebb5a5b..3981e54d01 100644
--- a/string.c
+++ b/string.c
@@ -1101,7 +1101,8 @@ rb_str_aref(str, indx)
return rb_str_subpat(str, indx, 0);
case T_STRING:
- if (rb_str_index(str, indx, 0) != -1) return indx;
+ if (rb_str_index(str, indx, 0) != -1)
+ return rb_str_dup(indx);
return Qnil;
default: