diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-09 02:29:24 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-09 02:29:24 +0000 |
commit | 54c146d2c3d8a9a5e3d4bbd8b5fd61e17ad45819 (patch) | |
tree | d2b105360fbe0b0ee6f508772d76510471e3f63e /string.c | |
parent | 221e6de720042585265cb38c05701663829ac40d (diff) |
* string.c (tr_trans): get rid of segfaults when has mulitbytes but
source sets have no mulitbytes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -3466,7 +3466,7 @@ tr_trans(VALUE str, VALUE src, VALUE repl, int sflag) v = trans[c] >= 0 ? trans[c] : Qnil; } else { - v = rb_hash_aref(hash, INT2NUM(c)); + v = hash ? rb_hash_aref(hash, INT2NUM(c)) : Qnil; } if (!NIL_P(v)) { if (!cflag) { @@ -3531,7 +3531,7 @@ tr_trans(VALUE str, VALUE src, VALUE repl, int sflag) v = trans[c] >= 0 ? trans[c] : Qnil; } else { - v = rb_hash_aref(hash, INT2NUM(c)); + v = hash ? rb_hash_aref(hash, INT2NUM(c)) : Qnil; } if (!NIL_P(v)) { if (!cflag) { |