summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--io.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 8c9b974bb0..c07163f0ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Fri Sep 6 10:34:32 2002 Minero Aoki <aamine@loveruby.net>
+
+ * io.c (rb_io_puts): RSTRING(line)->ptr might be NULL.
+
Fri Sep 6 10:26:37 2002 Minero Aoki <aamine@loveruby.net>
* parse.y: should not put non-NODE-VALUEs in the semantic stack.
diff --git a/io.c b/io.c
index 28cb8a51c7..90338e6f2a 100644
--- a/io.c
+++ b/io.c
@@ -2451,7 +2451,8 @@ rb_io_puts(argc, argv, out)
line = rb_obj_as_string(argv[i]);
}
rb_io_write(out, line);
- if (RSTRING(line)->ptr[RSTRING(line)->len-1] != '\n') {
+ if (RSTRING(line)->len == 0 ||
+ RSTRING(line)->ptr[RSTRING(line)->len-1] != '\n') {
rb_io_write(out, rb_default_rs);
}
}