summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jesse Hall <jessehall@google.com> 2011-12-05 11:10:32 -0800
committer Jesse Hall <jessehall@google.com> 2011-12-05 11:10:32 -0800
commit564f16a8d71b79b5e07a597a8f188efa8d80a0ee (patch)
tree323ba31bf746f1180a7b5cf98971a3c44c742afa
parentf57c1388860486a70cc773f2cfeaa3ea3b38a473 (diff)
Fix statusbar crash on devices with no Bluetooth
Change-Id: Ib2290f9cde54d0d52c2692b11b0232848bbbc8b0
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothController.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothController.java
index 903a300ad39f..603808ec830c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothController.java
@@ -36,7 +36,7 @@ public class BluetoothController extends BroadcastReceiver {
private int mIconId = R.drawable.stat_sys_data_bluetooth;
private int mContentDescriptionId = 0;
- private boolean mEnabled;
+ private boolean mEnabled = false;
public BluetoothController(Context context) {
mContext = context;
@@ -47,8 +47,10 @@ public class BluetoothController extends BroadcastReceiver {
context.registerReceiver(this, filter);
final BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
- handleAdapterStateChange(adapter.getState());
- handleConnectionStateChange(adapter.getConnectionState());
+ if (adapter != null) {
+ handleAdapterStateChange(adapter.getState());
+ handleConnectionStateChange(adapter.getConnectionState());
+ }
refreshViews();
}