summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
Diffstat (limited to 'error.c')
-rw-r--r--error.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/error.c b/error.c
index d1dfd03a9d..73705b0b58 100644
--- a/error.c
+++ b/error.c
@@ -1950,8 +1950,10 @@ name_err_mesg_to_str(VALUE obj)
d = rb_protect(name_err_mesg_receiver_name, obj, &state);
if (state || d == Qundef || d == Qnil)
d = rb_protect(rb_inspect, obj, &state);
- if (state)
+ if (state) {
rb_set_errinfo(Qnil);
+ }
+ d = rb_check_string_type(d);
if (NIL_P(d)) {
d = rb_any_to_s(obj);
}