mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
transcode.c: fix segv in String.encode!
* transcode.c (str_transcode0): fix segv in String.encode!. now rb_str_scrub() can return nil. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e7fac351c2
commit
e8d2806cfc
1 changed files with 3 additions and 1 deletions
|
@ -2699,7 +2699,9 @@ str_transcode0(int argc, VALUE *argv, VALUE *self, int ecflags, VALUE ecopts)
|
|||
if (!NIL_P(ecopts)) {
|
||||
rep = rb_hash_aref(ecopts, sym_replace);
|
||||
}
|
||||
*self = rb_str_scrub(str, rep);
|
||||
dest = rb_str_scrub(str, rep);
|
||||
if (NIL_P(dest)) dest = str;
|
||||
*self = dest;
|
||||
return dencidx;
|
||||
}
|
||||
return NIL_P(arg2) ? -1 : dencidx;
|
||||
|
|
Loading…
Reference in a new issue