Bug 1068872 - Fix nullptr dereferencing. r=echou
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 18 Sep 2014 07:00:00 -0400
changeset 206451 91fb84885bcda62b7a38b984792c256bb9bc6cc8
parent 206450 e99d8abbc53065b5a931f11330f6ab27bca9f969
child 206452 7fef64119cf40061d8cbfcfb0ed3ec458ff53c27
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersechou
bugs1068872
milestone35.0a1
Bug 1068872 - Fix nullptr dereferencing. r=echou
dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp
--- a/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp
+++ b/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp
@@ -1215,17 +1215,19 @@ private:
 void
 BluetoothHfpManager::Disconnect(BluetoothProfileController* aController)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(!mController);
 
   if (!sBluetoothHfpInterface) {
     BT_LOGR("sBluetoothHfpInterface is null");
-    aController->NotifyCompletion(NS_LITERAL_STRING(ERR_NO_AVAILABLE_RESOURCE));
+    if (aController) {
+      aController->NotifyCompletion(NS_LITERAL_STRING(ERR_NO_AVAILABLE_RESOURCE));
+    }
     return;
   }
 
   mController = aController;
 
   sBluetoothHfpInterface->Disconnect(mDeviceAddress,
                                      new DisconnectResultHandler(this));
 }