From 334078d88a7401b7f0481154655c5db848e63531 Mon Sep 17 00:00:00 2001 From: Ben Tian Date: Tue, 2 Jul 2013 16:53:21 +0800 Subject: [PATCH] Bug 889231 - [Bluetooth] Lock-up occurs when you make a call in no signal network state, r=echou --- dom/bluetooth/BluetoothTelephonyListener.cpp | 22 ++++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/dom/bluetooth/BluetoothTelephonyListener.cpp b/dom/bluetooth/BluetoothTelephonyListener.cpp index a7fe1c82cd2e..e84d577e8e3c 100644 --- a/dom/bluetooth/BluetoothTelephonyListener.cpp +++ b/dom/bluetooth/BluetoothTelephonyListener.cpp @@ -68,15 +68,19 @@ TelephonyListener::NotifyError(int32_t aCallIndex, const nsAString& aError) { BluetoothHfpManager* hfp = BluetoothHfpManager::Get(); - // In order to not miss any related call state transition. - // It's possible that 3G network signal lost for unknown reason. - // If a call is released abnormally, NotifyError() will be called, - // instead of CallStateChanged(). We need to reset the call array state - // via setting CALL_STATE_DISCONNECTED - hfp->HandleCallStateChanged(aCallIndex, - nsITelephonyProvider::CALL_STATE_DISCONNECTED, - EmptyString(), false, true); - NS_WARNING("Reset the call state due to call transition ends abnormally"); + + if (aCallIndex > 0) { + // In order to not miss any related call state transition. + // It's possible that 3G network signal lost for unknown reason. + // If a call is released abnormally, NotifyError() will be called, + // instead of CallStateChanged(). We need to reset the call array state + // via setting CALL_STATE_DISCONNECTED + hfp->HandleCallStateChanged(aCallIndex, + nsITelephonyProvider::CALL_STATE_DISCONNECTED, + EmptyString(), false, true); + NS_WARNING("Reset the call state due to call transition ends abnormally"); + } + NS_WARNING(NS_ConvertUTF16toUTF8(aError).get()); return NS_OK; }