fix autobug - apparently EXTRA_DEVICE can be null on some implementations

pull/276/head^2
Kevin Hester 2021-03-31 19:40:33 +08:00
rodzic d9a2a469bc
commit 091b18a5bb
1 zmienionych plików z 5 dodań i 3 usunięć

Wyświetl plik

@ -489,9 +489,11 @@ class MainActivity : AppCompatActivity(), Logging,
}
UsbManager.ACTION_USB_DEVICE_ATTACHED -> {
val device: UsbDevice = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE)!!
debug("Handle USB device attached! $device")
usbDevice = device
val device: UsbDevice? = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE)
if (device != null) {
debug("Handle USB device attached! $device")
usbDevice = device
}
}
Intent.ACTION_MAIN -> {