From 1739bfb3336b64e645e8ed06d201e65fffccf9eb Mon Sep 17 00:00:00 2001 From: Michael Chan <> Date: Mon, 30 Mar 2009 09:40:42 -0700 Subject: AI 143480: Fixed the problem where Settings would crash if you enable airplane mode, go Home, go back to Wireless Settings. This only happens in emulator. Bluetooth isn't supported in emulator but the crash was fixed so users can enable/disable Airplane Mode. BUG=1741119 Automated import of CL 143480 --- .../android/settings/bluetooth/LocalBluetoothManager.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/bluetooth/LocalBluetoothManager.java b/src/com/android/settings/bluetooth/LocalBluetoothManager.java index 1a848b2..273f797 100644 --- a/src/com/android/settings/bluetooth/LocalBluetoothManager.java +++ b/src/com/android/settings/bluetooth/LocalBluetoothManager.java @@ -199,9 +199,17 @@ public class LocalBluetoothManager { } private void syncBluetoothState() { - setBluetoothStateInt(mManager.isEnabled() - ? BluetoothDevice.BLUETOOTH_STATE_ON - : BluetoothDevice.BLUETOOTH_STATE_OFF); + int bluetoothState; + + if (mManager != null) { + bluetoothState = mManager.isEnabled() + ? BluetoothDevice.BLUETOOTH_STATE_ON + : BluetoothDevice.BLUETOOTH_STATE_OFF; + } else { + bluetoothState = BluetoothError.ERROR; + } + + setBluetoothStateInt(bluetoothState); } public void setBluetoothEnabled(boolean enabled) { -- cgit v1.1