summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/io.c b/io.c
index f04540417e..f150fb7617 100644
--- a/io.c
+++ b/io.c
@@ -5157,6 +5157,7 @@ pop_last_hash(int *argc_p, VALUE *argv)
if (*argc_p == 0)
return Qnil;
last = argv[*argc_p-1];
+ if (NIL_P(last)) return Qnil;
tmp = rb_check_convert_type(last, T_HASH, "Hash", "to_hash");
if (NIL_P(tmp))
return Qnil;
@@ -6066,12 +6067,17 @@ rb_io_puts(int argc, VALUE *argv, VALUE out)
return Qnil;
}
for (i=0; i<argc; i++) {
+ if (TYPE(argv[i]) == T_STRING) {
+ line = argv[i];
+ goto string;
+ }
line = rb_check_array_type(argv[i]);
if (!NIL_P(line)) {
rb_exec_recursive(io_puts_ary, line, out);
continue;
}
line = rb_obj_as_string(argv[i]);
+ string:
rb_io_write(out, line);
if (RSTRING_LEN(line) == 0 ||
RSTRING_PTR(line)[RSTRING_LEN(line)-1] != '\n') {