From f9f78b81da37f19f7d193efc180614291d2ee299 Mon Sep 17 00:00:00 2001 From: Enyby Date: Mon, 7 Oct 2019 14:26:21 +0300 Subject: [PATCH] Allow read zero bytes in io lib methods. --- src/core/org/luaj/vm2/lib/IoLib.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/org/luaj/vm2/lib/IoLib.java b/src/core/org/luaj/vm2/lib/IoLib.java index 34b3e941..94a9ef52 100644 --- a/src/core/org/luaj/vm2/lib/IoLib.java +++ b/src/core/org/luaj/vm2/lib/IoLib.java @@ -594,7 +594,7 @@ public class IoLib extends TwoArgFunction { int c; try { if ( lineonly ) { - loop: while ( (c = f.read()) > 0 ) { + loop: while ( (c = f.read()) >= 0 ) { switch ( c ) { case '\r': if (withend) baos.write(c); break; case '\n': if (withend) baos.write(c); break loop; @@ -602,7 +602,7 @@ public class IoLib extends TwoArgFunction { } } } else { - while ( (c = f.read()) > 0 ) + while ( (c = f.read()) >= 0 ) baos.write(c); } } catch ( EOFException e ) {