summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/string.c b/string.c
index 1e55148f47..f1dd8b3b35 100644
--- a/string.c
+++ b/string.c
@@ -722,8 +722,10 @@ rb_str_equal(str1, str2)
VALUE str1, str2;
{
if (str1 == str2) return Qtrue;
- if (TYPE(str2) != T_STRING)
- return Qfalse;
+ if (TYPE(str2) != T_STRING) {
+ str2 = rb_check_convert_type(str2, T_STRING, "String", "to_str");
+ if (NIL_P(str2)) return Qfalse;
+ }
if (RSTRING(str1)->len == RSTRING(str2)->len
&& rb_str_cmp(str1, str2) == 0) {