diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-21 06:16:02 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-21 06:16:02 +0000 |
| commit | 4baea7dd8ee879dfff74df824c7e5963ff954625 (patch) | |
| tree | c88a62c8e9a554de06d87954163c8403b10ecd9e | |
| parent | 8fa21bc05fc892d9c8569f5f3974e993621d9785 (diff) | |
* encoding.c (rb_to_encoding_index): should return error instead of
exception even if type is incorrect.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | encoding.c | 3 |
2 files changed, 8 insertions, 0 deletions
@@ -1,3 +1,8 @@ +Fri Dec 21 15:16:00 2007 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * encoding.c (rb_to_encoding_index): should return error instead of + exception even if type is incorrect. + Fri Dec 21 14:58:27 2007 Yukihiro Matsumoto <matz@ruby-lang.org> * enumerator.c (enumerator_init_copy): prohibit cloning of diff --git a/encoding.c b/encoding.c index ba83837f49..819ac54071 100644 --- a/encoding.c +++ b/encoding.c @@ -81,6 +81,9 @@ rb_to_encoding_index(VALUE enc) if (idx >= 0) { return idx; } + else if (NIL_P(enc = rb_check_string_type(enc))) { + return -1; + } else { return rb_enc_find_index(StringValueCStr(enc)); } |
