summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/string.c b/string.c
index 61703a7057..606fef7a42 100644
--- a/string.c
+++ b/string.c
@@ -1483,6 +1483,7 @@ str_nth_len(const char *p, const char *e, long *nthp, rb_encoding *enc)
if (ISASCII(*p)) {
p2 = search_nonascii(p, e2);
if (!p2) {
+ nth -= e2 - p;
*nthp = nth;
return (char *)e2;
}