Skip to content

Commit

Permalink
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/src/main/java/org/jruby/ext/stringio/StringIO.java
Original file line number Diff line number Diff line change
@@ -622,6 +622,10 @@ public RubyArray getline(ThreadContext context, StringIO self, IRubyObject rs, i
RubyArray ary = context.runtime.newArray();
IRubyObject line;

if (limit == 0) {
throw context.runtime.newArgumentError("invalid limit: 0 for readlines");
}

while (!(line = self.getline(context, rs, limit, chomp)).isNil()) {
ary.append(line);
}

0 comments on commit e21e4e1

Please sign in to comment.