aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/io.c b/io.c
index 11b6499a41..9d75c230f4 100644
--- a/io.c
+++ b/io.c
@@ -11247,7 +11247,9 @@ argf_getpartial(int argc, VALUE *argv, VALUE argf, VALUE opts, int nonblock)
}
if (!next_argv()) {
- rb_str_resize(str, 0);
+ if (!NIL_P(str)) {
+ rb_str_resize(str, 0);
+ }
rb_eof_error();
}
if (ARGF_GENERIC_INPUT_P()) {