bluetoothappprofiles/avrcp/remconbeareravrcp/src/playerstatewatcher.cpp
changeset 52 4545c04e61e1
parent 15 00f9ee97d895
child 56 9386f31cc85b
--- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/playerstatewatcher.cpp	Tue Jul 06 14:27:09 2010 +0300
+++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/src/playerstatewatcher.cpp	Wed Aug 18 09:59:05 2010 +0300
@@ -37,14 +37,17 @@
 void CPlayerWatcherBase::StopWatchingPlayer(TRemConClientId aClientId)
 	{
 	LOG_FUNC;
-	CInternalCommand* command = *iCommands.Find(aClientId);
-	__ASSERT_DEBUG(command, AVRCP_PANIC(ENotWatchingPlayer));
-
-	TUint transId = command->RemConCommandId();
-	iCommandInterface.MrcciCommandExpired(transId);
-
-	iCommands.Remove(aClientId);
-	command->DecrementUsers();
+	CInternalCommand** cmdPtr = iCommands.Find(aClientId);
+	if (cmdPtr) // This may be NULL if we've already stopped watching the player as a result of reciving a reject
+	    {
+        CInternalCommand* cmd = *cmdPtr;
+        
+        TUint transId = cmd->RemConCommandId();
+        iCommandInterface.MrcciCommandExpired(transId);
+    
+        iCommands.Remove(aClientId);
+        cmd->DecrementUsers();
+	    }
 	}
 
 void CPlayerWatcherBase::MessageSent(CAvrcpCommand& /*aCommand*/, TInt /*aSendResult*/)