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:
+1
-1
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user