summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
Diffstat (limited to 'error.c')
-rw-r--r--error.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/error.c b/error.c
index 3fcd18478d..2cced9aa62 100644
--- a/error.c
+++ b/error.c
@@ -880,7 +880,7 @@ name_err_mesg_to_str(VALUE obj)
break;
}
if (desc && desc[0] != '#') {
- d = rb_str_new2(desc);
+ d = d ? rb_str_dup(d) : rb_str_new2(desc);
rb_str_cat2(d, ":");
rb_str_cat2(d, rb_obj_classname(obj));
}