diff options
author | Diogo Ferreira <defer@cyngn.com> | 2014-12-03 15:10:21 +0000 |
---|---|---|
committer | Adnan Begovic <adnan@cyngn.com> | 2015-10-28 13:24:51 -0700 |
commit | a674c562ff8fcf3c0c0597c9463fefe2edfeb7f2 (patch) | |
tree | 4efd5779fe361d3f4b8a32473e7879a30c4b6db7 /src/com/android/settings/bluetooth | |
parent | 037b0f8ad43d570f97dbf49848dab7c8b6b38513 (diff) | |
download | packages_apps_Settings-a674c562ff8fcf3c0c0597c9463fefe2edfeb7f2.zip packages_apps_Settings-a674c562ff8fcf3c0c0597c9463fefe2edfeb7f2.tar.gz packages_apps_Settings-a674c562ff8fcf3c0c0597c9463fefe2edfeb7f2.tar.bz2 |
bluetooth: Don't crash when the local adapter is not set
In devices where bluetooth is not working (like the emulator or devices
in development), the bluetooth Settings crashes when closing the activity.
Most of the code checks for the nullability of the local adapter except
for this particular piece. This is usually not a worry for production
devices and I wouldn't usually worry about this but since the rest of the
code performs the nullability check it seems silly to crash onPause.
Change-Id: I7c1d3b43969b516336be770957008ef2054d312f
Diffstat (limited to 'src/com/android/settings/bluetooth')
-rw-r--r-- | src/com/android/settings/bluetooth/BluetoothSettings.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java index ab5cf26..d63dbe4 100644 --- a/src/com/android/settings/bluetooth/BluetoothSettings.java +++ b/src/com/android/settings/bluetooth/BluetoothSettings.java @@ -251,7 +251,9 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem } // Make the device only visible to connected devices. - mLocalAdapter.setScanMode(BluetoothAdapter.SCAN_MODE_CONNECTABLE); + if (mLocalAdapter != null) { + mLocalAdapter.setScanMode(BluetoothAdapter.SCAN_MODE_CONNECTABLE); + } if (isUiRestricted()) { return; |