mirror of
https://github.com/mik3y/usb-serial-for-android
synced 2025-06-07 07:56:20 +00:00
Added error management inside read function to get more appropriate exception (#529)
This commit is contained in:
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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user