diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/io/TInputStream.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/io/TInputStream.java index 8e0255e65..b920d370f 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/io/TInputStream.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/io/TInputStream.java @@ -36,7 +36,7 @@ public abstract class TInputStream extends TObject implements TCloseable { for (int i = 0; i < len; ++i) { int bt = read(); if (bt < 0) { - return i; + return i == 0 ? -1 : i; } b[off++] = (byte)bt; }