aboutsummaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/string.c b/string.c
index 053db6cbb5..53c4027923 100644
--- a/string.c
+++ b/string.c
@@ -2074,7 +2074,7 @@ rb_str_index(VALUE str, VALUE sub, long offset)
pos = rb_memsearch(sptr, slen, s, len);
if (pos < 0) return pos;
t = rb_enc_right_char_head(s, s+pos, enc);
- if (t == s) break;
+ if (t == s + pos) break;
if ((len -= t - s) <= 0) return -1;
offset += t - s;
s = t;