Commit fafd4209 authored by Matej Frančeškin's avatar Matej Frančeškin

Fix for java open accessory crash

parent 63778dc4
......@@ -107,7 +107,7 @@ public class QGCActivity extends QtActivity
String action = intent.getAction();
if (ACTION_USB_PERMISSION.equals(action)) {
UsbAccessory accessory = intent.getParcelableExtra(UsbManager.EXTRA_ACCESSORY);
if (intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false)) {
if (accessory != null && intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false)) {
openAccessory(accessory);
}
} else if( UsbManager.ACTION_USB_ACCESSORY_DETACHED.equals(action)) {
......@@ -730,6 +730,9 @@ public class QGCActivity extends QtActivity
UsbAccessory[] accessories = _usbManager.getAccessoryList();
if (accessories != null) {
for (UsbAccessory usbAccessory : accessories) {
if (usbAccessory == null) {
continue;
}
if (_usbManager.hasPermission(usbAccessory)) {
openAccessory(usbAccessory);
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment