summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/string.c b/string.c
index 615af97e67..4a37f213ab 100644
--- a/string.c
+++ b/string.c
@@ -1416,6 +1416,10 @@ rb_str_succ(orig)
if ((c = succ_char(s)) == 0) break;
n = s - sbeg;
}
+ else if (c != -1) {
+ n = ++s - sbeg;
+ break;
+ }
s--;
}
if (c == -1) { /* str contains no alnum */
@@ -1425,8 +1429,9 @@ rb_str_succ(orig)
if ((*s += 1) != 0) break;
s--;
}
+ c = 0;
}
- if (s < sbeg) {
+ if (s < sbeg || c > 0) {
RESIZE_CAPA(str, RSTRING(str)->len + 1);
s = RSTRING(str)->ptr + n;
memmove(s+1, s, RSTRING(str)->len - n);