Don't crash if the app doesn't have Bluetooth permissions
authorSam Lantinga <slouken@libsdl.org>
Tue, 21 Aug 2018 11:59:13 -0700
changeset 1212942ff8f08c740
parent 12128 dfd9a3bda4e4
child 12130 24142c5073a4
Don't crash if the app doesn't have Bluetooth permissions
android-project/app/src/main/java/org/libsdl/app/HIDDeviceManager.java
     1.1 --- a/android-project/app/src/main/java/org/libsdl/app/HIDDeviceManager.java	Tue Aug 21 11:44:08 2018 -0700
     1.2 +++ b/android-project/app/src/main/java/org/libsdl/app/HIDDeviceManager.java	Tue Aug 21 11:59:13 2018 -0700
     1.3 @@ -366,7 +366,11 @@
     1.4      }
     1.5  
     1.6      protected void shutdownBluetooth() {
     1.7 -        mContext.unregisterReceiver(mBluetoothBroadcast);
     1.8 +        try {
     1.9 +            mContext.unregisterReceiver(mBluetoothBroadcast);
    1.10 +        } catch (Exception e) {
    1.11 +            // We may not have registered, that's okay
    1.12 +        }
    1.13      }
    1.14  
    1.15      // Chromebooks do not pass along ACTION_ACL_CONNECTED / ACTION_ACL_DISCONNECTED properly.