sipvoipprovider/src/svpsslogcall.cpp
branchRCL_3
changeset 10 ed1e38b404e5
parent 0 a4daefaec16c
child 11 6134b5029079
--- a/sipvoipprovider/src/svpsslogcall.cpp	Mon Mar 15 12:39:55 2010 +0200
+++ b/sipvoipprovider/src/svpsslogcall.cpp	Wed Mar 31 21:20:05 2010 +0300
@@ -211,10 +211,16 @@
                         {
                         SVPDEBUG1("CSVPSSLogCall::FindContactTitleL, manyCompleteMatches");
                         manyCompleteMatches = ETrue;
+                        
+                        // Set to NULL if multiple matches                     
+                        if ( title )
+                            {
+                            delete title;
+                            title = NULL;
+                            }       
                         }
                     else
-                        {
-    					iLogEvent->SetContact( contactId ); // Set aItem based on complete match.
+                        {					
 						title = tempContactItem->GetContactTitleL();
                         compId = contactId;
                         ind = count;
@@ -224,6 +230,12 @@
             }
         contactId = iter->NextL();
         }
+    
+    // Set contact if only one match found
+    if ( compId && !manyCompleteMatches )
+        {
+        iLogEvent->SetContact( compId );
+        } 
 
     CleanupStack::PopAndDestroy( iter );
     CleanupStack::PopAndDestroy( contacts );
@@ -277,8 +289,8 @@
         SVPDEBUG1("  CSVPSSLogCall::HandleCallLoggingL, URI address is seen" );
         HBufC* contactName = FindContactTitleL( number );
 	    if ( contactName )
-		    { //  Phonebook contact id has been found
-		    //tempBufTwo.Copy( contactName->Des() );
+		    { 
+	        //  Phonebook contact id has been found
 		    tempBufTwo.Copy( number );
 		    iLogEvent->SetRemoteParty( contactName->Des() );
 	        }
@@ -287,7 +299,13 @@
 	       	tempBufTwo.Copy( number );
 	       	iLogEvent->SetRemoteParty( number );
 	        }
-	    delete contactName;
+	    
+	    if ( contactName )
+	        {
+	        delete contactName;
+	        contactName = NULL;
+	        }
+	    
 	    tempBufOne.Append( tempBufTwo );             
 	    tempBufTwo.Zero();
 	    tempBufOne.Append( KLogFieldDelimiter() );