emailcontacts/contactactionservice/src/cfscactionutils.cpp
branchRCL_3
changeset 73 c8382f7b54ef
parent 70 968773a0b6ef
child 80 726fba06891a
--- a/emailcontacts/contactactionservice/src/cfscactionutils.cpp	Tue Sep 14 20:48:24 2010 +0300
+++ b/emailcontacts/contactactionservice/src/cfscactionutils.cpp	Wed Sep 15 11:52:37 2010 +0300
@@ -1246,11 +1246,18 @@
 
     if ( fieldFilter->FieldCount() == 1 )
         {
-        MVPbkStoreContactField* field = fieldFilter->FieldAtLC( 0 );
         if ( aAddSpace && aContact.Length() > 0 )
             {
-            aContact.Append( KSpace );
+            if ( aContact.Length() < KMaxLengthOfName )
+                {
+                aContact.Append( KSpace );
+                }
+            else
+                {
+                User::Leave( KErrOverflow );
+                }
             }
+        MVPbkStoreContactField* field = fieldFilter->FieldAtLC( 0 );
         TPtrC castFieldText = MVPbkContactFieldTextData::Cast( 
                 field->FieldData() ).Text();
 
@@ -1259,9 +1266,8 @@
             User::Leave( KErrOverflow );
             }
 
-        aContact.Append( MVPbkContactFieldTextData::Cast(
-                field->FieldData() ).Text() );
-        CleanupStack::PopAndDestroy(); // field
+        aContact.Append( castFieldText );
+        CleanupStack::PopAndDestroy( field );
         }
     CleanupStack::PopAndDestroy( 2 ); // fieldFilter, fieldTypeSelector    
     }