mirror of
https://github.com/mik3y/usb-serial-for-android
synced 2025-06-07 16:06:10 +00:00
open(): Set mConnection eagerly, and clear on failure.
Similar to CdcAcmSerialDriver. Issue #53.
This commit is contained in:
parent
61714523fc
commit
66eec6c870
@ -243,6 +243,7 @@ public class FtdiSerialDriver implements UsbSerialDriver {
|
||||
if (mConnection != null) {
|
||||
throw new IOException("Already open");
|
||||
}
|
||||
mConnection = connection;
|
||||
|
||||
boolean opened = false;
|
||||
try {
|
||||
@ -258,8 +259,7 @@ public class FtdiSerialDriver implements UsbSerialDriver {
|
||||
} finally {
|
||||
if (!opened) {
|
||||
close();
|
||||
} else {
|
||||
mConnection = connection;
|
||||
mConnection = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user