aboutsummaryrefslogtreecommitdiffstats
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 52c3a70b5b..885b3e608e 100644
--- a/string.c
+++ b/string.c
@@ -2581,6 +2581,7 @@ rb_str_split_m(argc, argv, str)
else {
end = beg+1;
skip = 0;
+ if (!NIL_P(limit) && lim <= i) break;
}
}
else {
@@ -2588,7 +2589,7 @@ rb_str_split_m(argc, argv, str)
rb_ary_push(result, rb_str_substr(str, beg, end-beg));
skip = 1;
beg = end + 1;
- if (!NIL_P(limit) && lim <= ++i) break;
+ if (!NIL_P(limit)) ++i;
}
else {
end++;