1
0
mirror of https://github.com/mik3y/usb-serial-for-android.git synced 2026-08-11 16:32:53 +00:00

Added error management inside read function to get more appropriate exception (#529)

This commit is contained in:
ExPl0siF
2023-08-24 18:49:29 +02:00
committed by GitHub
parent 54ff9bfa44
commit 399d3c9c2f
@@ -170,7 +170,7 @@ public abstract class CommonUsbSerialPort implements UsbSerialPort {
}
protected int read(final byte[] dest, final int timeout, boolean testConnection) throws IOException {
if(mConnection == null) {
if(mConnection == null || mUsbRequest == null) {
throw new IOException("Connection closed");
}
if(dest.length <= 0) {