aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--error.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/error.c b/error.c
index d4c38f8cbb..0ec0cf895a 100644
--- a/error.c
+++ b/error.c
@@ -303,7 +303,10 @@ rb_warn_m(int argc, VALUE *argv, VALUE exc)
VALUE str;
for (i = 0; i < argc; i++) {
str = rb_obj_as_string(argv[i]);
- if (RSTRING_LEN(str) == 0 || !rb_str_end_with_asciichar(str, '\n')) {
+ if (RSTRING_LEN(str) == 0) {
+ str = rb_default_rs;
+ }
+ else if (!rb_str_end_with_asciichar(str, '\n')) {
str = rb_str_cat(rb_str_dup(str), "\n", 1);
}
rb_write_warning_str(str);