1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* string.c (rb_str_split_m): RSTRING(str)->ptr might become NULL.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
aamine 2002-10-24 17:54:53 +00:00
parent 57d2e81af5
commit 42e292ae33
2 changed files with 9 additions and 1 deletions

View file

@ -1,3 +1,7 @@
Fri Oct 25 02:55:01 2002 Minero Aoki <aamine@loveruby.net>
* string.c (rb_str_split_m): RSTRING(str)->ptr might become NULL.
Thu Oct 24 21:57:02 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* configure.in (LIBPATHFLAG): avoid $ substitution.

View file

@ -2533,7 +2533,11 @@ rb_str_split_m(argc, argv, str)
while ((end = rb_reg_search(spat, str, start, 0)) >= 0) {
regs = RMATCH(rb_backref_get())->regs;
if (start == end && BEG(0) == END(0)) {
if (last_null == 1) {
if (!RSTRING(str)->ptr) {
rb_ary_push(result, rb_str_new("", 0));
break;
}
else if (last_null == 1) {
rb_ary_push(result, rb_str_substr(str, beg, mbclen2(RSTRING(str)->ptr[beg],spat)));
beg = start;
}