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 35cfb3943a..733a7dfc30 100644
--- a/string.c
+++ b/string.c
@@ -2613,7 +2613,7 @@ rb_str_split_m(argc, argv, str)
if (!NIL_P(limit) && lim <= ++i) break;
}
}
- if (!NIL_P(limit) || RSTRING(str)->len > beg || lim < 0) {
+ if (RSTRING(str)->len > 0 && (!NIL_P(limit) || RSTRING(str)->len > beg || lim < 0)) {
if (RSTRING(str)->len == beg)
tmp = rb_str_new5(str, 0, 0);
else