summaryrefslogtreecommitdiff
path: root/encoding.c
diff options
context:
space:
mode:
Diffstat (limited to 'encoding.c')
-rw-r--r--encoding.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/encoding.c b/encoding.c
index 9002a1f17f..5e8412a026 100644
--- a/encoding.c
+++ b/encoding.c
@@ -876,6 +876,8 @@ enc_compatible_p(VALUE klass, VALUE str1, VALUE str2)
{
rb_encoding *enc;
+ if (enc_check_encoding(str1) > 0 || enc_check_encoding(str2) > 0)
+ rb_raise(rb_eTypeError, "wrong argument type Encoding (expected String)");
if (!enc_capable(str1)) return Qnil;
if (!enc_capable(str2)) return Qnil;
enc = rb_enc_compatible(str1, str2);