From 94da8b17374a71b451e9b7f3b6e97ab058bdbc81 Mon Sep 17 00:00:00 2001 From: shugo Date: Wed, 25 Nov 2015 01:57:48 +0000 Subject: * io.c (argf_getpartial): should not resize str if the second argument is not given. [ruby-core:71668] [Bug #11738] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- io.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'io.c') 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()) { -- cgit v1.2.3