OSDN Git Service

Avoid NPE when dumping headset profile state.
authorSharvil Nanavati <sharvil@google.com>
Sat, 26 Sep 2015 23:22:21 +0000 (16:22 -0700)
committerSharvil Nanavati <sharvil@google.com>
Sat, 26 Sep 2015 23:22:21 +0000 (16:22 -0700)
Change-Id: I91767bcc09d4e16a9bd5c8dbe2e662a96f9880a5

src/com/android/bluetooth/hfpclient/HeadsetClientStateMachine.java

index de731a6..f9cadab 100644 (file)
@@ -175,13 +175,19 @@ final class HeadsetClientStateMachine extends StateMachine {
         ProfileService.println(sb, "mSubscriberInfo: " + mSubscriberInfo);
         ProfileService.println(sb, "mVoiceRecognitionActive: " + mVoiceRecognitionActive);
         ProfileService.println(sb, "mInBandRingtone: " + mInBandRingtone);
+
         ProfileService.println(sb, "mCalls:");
-        for (BluetoothHeadsetClientCall call : mCalls.values()) {
-            ProfileService.println(sb, "  " + call);
+        if (mCalls != null) {
+            for (BluetoothHeadsetClientCall call : mCalls.values()) {
+                ProfileService.println(sb, "  " + call);
+            }
         }
+
         ProfileService.println(sb, "mCallsUpdate:");
-        for (BluetoothHeadsetClientCall call : mCallsUpdate.values()) {
-            ProfileService.println(sb, "  " + call);
+        if (mCallsUpdate != null) {
+            for (BluetoothHeadsetClientCall call : mCallsUpdate.values()) {
+                ProfileService.println(sb, "  " + call);
+            }
         }
     }