From 7618faa5df18324c581ade91f75454e2e3d8ad49 Mon Sep 17 00:00:00 2001 From: Sharvil Nanavati Date: Sat, 26 Sep 2015 16:22:21 -0700 Subject: [PATCH] Avoid NPE when dumping headset profile state. Change-Id: I91767bcc09d4e16a9bd5c8dbe2e662a96f9880a5 --- .../bluetooth/hfpclient/HeadsetClientStateMachine.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachine.java b/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachine.java index de731a61..f9cadabe 100644 --- a/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachine.java +++ b/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachine.java @@ -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); + } } } -- 2.11.0