Skip to content

Commit d81fa76

Browse files
committed
Fix possible crash
1 parent 58e24bf commit d81fa76

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/src/main/java/info/martinmarinov/drivers/tools/UsbPermissionObtainer.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ public void onReceive(Context context, Intent intent) {
6060
String action = intent.getAction();
6161
if (ACTION_USB_PERMISSION.equals(action)) {
6262
synchronized (this) {
63+
if (task.isDone()) {
64+
Log.d(TAG, "Permission already should be processed, ignoring.");
65+
return;
66+
}
6367
UsbManager manager = (UsbManager) context.getSystemService(Context.USB_SERVICE);
6468
UsbDevice device = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
6569
if (device.equals(usbDevice)) {

0 commit comments

Comments
 (0)