summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/io.c b/io.c
index 9fa241f6c3..52216cff43 100644
--- a/io.c
+++ b/io.c
@@ -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)) {