From 564f16a8d71b79b5e07a597a8f188efa8d80a0ee Mon Sep 17 00:00:00 2001 From: Jesse Hall Date: Mon, 5 Dec 2011 11:10:32 -0800 Subject: Fix statusbar crash on devices with no Bluetooth Change-Id: Ib2290f9cde54d0d52c2692b11b0232848bbbc8b0 --- .../android/systemui/statusbar/policy/BluetoothController.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'packages/SystemUI') 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 903a300..603808e 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(); } -- cgit v1.1