Skip to content

Commit 3e7b412

Browse files
critsecAndroid (Google) Code Review
authored andcommitted
Merge "Fix statusbar crash on devices with no Bluetooth" into ics-mr1
2 parents 0d9a41e + 564f16a commit 3e7b412

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothController.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class BluetoothController extends BroadcastReceiver {
3636

3737
private int mIconId = R.drawable.stat_sys_data_bluetooth;
3838
private int mContentDescriptionId = 0;
39-
private boolean mEnabled;
39+
private boolean mEnabled = false;
4040

4141
public BluetoothController(Context context) {
4242
mContext = context;
@@ -47,8 +47,10 @@ public BluetoothController(Context context) {
4747
context.registerReceiver(this, filter);
4848

4949
final BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
50-
handleAdapterStateChange(adapter.getState());
51-
handleConnectionStateChange(adapter.getConnectionState());
50+
if (adapter != null) {
51+
handleAdapterStateChange(adapter.getState());
52+
handleConnectionStateChange(adapter.getConnectionState());
53+
}
5254
refreshViews();
5355
}
5456

0 commit comments

Comments
 (0)