diff options
-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)); } |