summaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-09-06 01:58:32 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-09-06 01:58:32 +0000
commitbd163f2cff04da20ec2240f28f2f4172099d265f (patch)
tree7e91fbc1484a047c8f1abdf7e252b48ef6ecc125 /io.c
parent69f937c3f17b4df55e467f8985abc7955fcaf9ff (diff)
downloadruby-bd163f2cff04da20ec2240f28f2f4172099d265f.tar.gz
ruby-bd163f2cff04da20ec2240f28f2f4172099d265f.tar.xz
ruby-bd163f2cff04da20ec2240f28f2f4172099d265f.zip
* io.c (rb_io_puts): RSTRING(line)->ptr might be NULL.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@2805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/io.c b/io.c
index 28cb8a51c..90338e6f2 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);
}
}