bearermanagement/S60MCPR/src/s60mpmrequests.cpp
changeset 50 6a30cdd10231
parent 18 fcbbe021d614
child 73 70ee5458c95d
--- a/bearermanagement/S60MCPR/src/s60mpmrequests.cpp	Tue Jul 13 11:25:48 2010 +0300
+++ b/bearermanagement/S60MCPR/src/s60mpmrequests.cpp	Fri Jul 23 09:11:14 2010 +0300
@@ -847,10 +847,15 @@
     // Asynchronous cancellation adds message to MPMServer's IPC queue but since we
     // queue all requests we can safely always call the SendCancelRequest()
     
+    // Sanity check.
+    S60MCPRLOGSTRING2( "S60MCPR::CMPMPolicyRequests<%x>::CancelRequest() %d", this, (TInt)aRequestCode )
+    if ( iPolicyRequests.Count() == 0 )
+        {
+        S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::CancelRequest(): Error: Nothing to cancel!", this )
+        return;
+        }
     // If the cancelled request is the active one.
-    //
-    S60MCPRLOGSTRING2( "S60MCPR::CMPMPolicyRequests<%x>::CancelRequest() %d", this, (TInt)aRequestCode )
-    if ( iPolicyRequests[0].iRequestType == aRequestCode )
+    else if ( iPolicyRequests[0].iRequestType == aRequestCode )
         {
         // Cancel the query if active
         //
@@ -877,7 +882,6 @@
             }
         }
     // Else we need to find it from the queue
-    //
     else 
         {
         S60MCPRLOGSTRING1( "S60MCPR::CMPMPolicyRequests<%x>::CancelRequest() Cancelling pending request", this )