summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/io.c b/io.c
index e5504b02da..79c2ea3461 100644
--- a/io.c
+++ b/io.c
@@ -411,12 +411,12 @@ io_write(io, str)
rb_secure(4);
if (TYPE(str) != T_STRING)
str = rb_obj_as_string(str);
- if (RSTRING(str)->len == 0) return INT2FIX(0);
if (TYPE(io) != T_FILE) {
/* port is not IO, call write method for it. */
return rb_funcall(io, id_write, 1, str);
}
+ if (RSTRING(str)->len == 0) return INT2FIX(0);
GetOpenFile(io, fptr);
rb_io_check_writable(fptr);