From 74e88ee33cca9002737e47b6172ca6e1bad8db6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Mon, 18 Jul 2016 20:08:46 +0200 Subject: [PATCH] Fixes #1972. --- src/main/scala/li/cil/oc/server/component/InternetCard.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/scala/li/cil/oc/server/component/InternetCard.scala b/src/main/scala/li/cil/oc/server/component/InternetCard.scala index 08d82dbe4..b9d08a7c6 100644 --- a/src/main/scala/li/cil/oc/server/component/InternetCard.scala +++ b/src/main/scala/li/cil/oc/server/component/InternetCard.scala @@ -264,7 +264,7 @@ object InternetCard { @Callback(doc = """function([n:number]):string -- Tries to read data from the socket stream. Returns the read byte array.""") def read(context: Context, args: Arguments): Array[AnyRef] = this.synchronized { - val n = math.min(Settings.get.maxReadBuffer, math.max(0, args.optInteger(1, Int.MaxValue))) + val n = math.min(Settings.get.maxReadBuffer, math.max(0, args.optInteger(0, Int.MaxValue))) if (checkConnected()) { val buffer = ByteBuffer.allocate(n) val read = channel.read(buffer) @@ -389,7 +389,7 @@ object InternetCard { @Callback(doc = """function([n:number]):string -- Tries to read data from the response. Returns the read byte array.""") def read(context: Context, args: Arguments): Array[AnyRef] = this.synchronized { - val n = math.min(Settings.get.maxReadBuffer, math.max(0, args.optInteger(1, Int.MaxValue))) + val n = math.min(Settings.get.maxReadBuffer, math.max(0, args.optInteger(0, Int.MaxValue))) if (checkResponse()) { if (eof && queue.isEmpty) result(Unit) else {