diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-07-21 01:25:55 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-07-21 01:25:55 +0000 |
commit | c98b3a7e193a8a3a930938431c26a6fe1f709bd9 (patch) | |
tree | de373ecfb94521e8f87f7ffff0303de664c848b8 /io.c | |
parent | 1b16c560e4941fe1505a92d1cf1c8873134014bb (diff) | |
download | ruby-c98b3a7e193a8a3a930938431c26a6fe1f709bd9.tar.gz |
* io.c (prepare_getline_args): check if rs is a string when non-nil
lim is given. [ruby-dev:35610]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -1892,7 +1892,10 @@ prepare_getline_args(int argc, VALUE *argv, VALUE *rsp, long *limit, VALUE io) } else { rb_scan_args(argc, argv, "11", &rs, &lim); - if (NIL_P(lim) && !NIL_P(rs) && TYPE(rs) != T_STRING) { + if (!NIL_P(lim)) { + StringValue(rs); + } + else if (!NIL_P(rs) && TYPE(rs) != T_STRING) { VALUE tmp = rb_check_string_type(rs); if (NIL_P(tmp)) { |