diff --git a/privmx-endpoint-extra/src/main/java/com/simplito/java/privmx_endpoint_extra/inboxFileStream/InboxFileStreamWriter.java b/privmx-endpoint-extra/src/main/java/com/simplito/java/privmx_endpoint_extra/inboxFileStream/InboxFileStreamWriter.java index 7cc4bf7..82846d3 100644 --- a/privmx-endpoint-extra/src/main/java/com/simplito/java/privmx_endpoint_extra/inboxFileStream/InboxFileStreamWriter.java +++ b/privmx-endpoint-extra/src/main/java/com/simplito/java/privmx_endpoint_extra/inboxFileStream/InboxFileStreamWriter.java @@ -82,14 +82,14 @@ public void writeStream(long inboxHandle, InputStream inputStream, StoreFileStre if (streamController != null) { setProgressListener(streamController); } - byte[] chunk = new byte[(int) StoreFileStream.OPTIMAL_SEND_SIZE]; + byte[] chunk = new byte[(int) InboxFileStream.OPTIMAL_SEND_SIZE]; int readed; while (true) { if (streamController != null && streamController.isStopped()) { - break; + return; } if ((readed = inputStream.read(chunk)) <= 0) { - break; + return; } write(inboxHandle, Arrays.copyOf(chunk, readed)); }