summaryrefslogtreecommitdiff
path: root/encoding.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-21 06:16:02 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-21 06:16:02 +0000
commit4baea7dd8ee879dfff74df824c7e5963ff954625 (patch)
treec88a62c8e9a554de06d87954163c8403b10ecd9e /encoding.c
parent8fa21bc05fc892d9c8569f5f3974e993621d9785 (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
Diffstat (limited to 'encoding.c')
-rw-r--r--encoding.c3
1 files changed, 3 insertions, 0 deletions
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));
}