ipsservices/ipssosplugin/src/ipsplgmsgmapper.cpp
changeset 1 12c456ceeff2
parent 0 8466d47a6819
child 3 a4d6f1ea0416
--- a/ipsservices/ipssosplugin/src/ipsplgmsgmapper.cpp	Thu Dec 17 08:39:21 2009 +0200
+++ b/ipsservices/ipssosplugin/src/ipsplgmsgmapper.cpp	Thu Jan 07 12:38:38 2010 +0200
@@ -190,25 +190,28 @@
             CMsvEntry* cEntry = iSession.GetEntryL( aEntry.Id() );
             CleanupStack::PushL( cEntry );
 
-            if ( cEntry && cEntry->HasStoreL() )
-                {
-                store = cEntry->ReadStoreL();
-                CleanupStack::PushL( store );
-                }
-
-            SetEnvelopeL( cEntry, store, *result );
+            if ( cEntry )
+            	{
+            	if ( cEntry->HasStoreL() )
+					{
+					store = cEntry->ReadStoreL();
+					CleanupStack::PushL( store );
+					}
 
-            // Apparently, this should be done only with
-            // EFSMsgDataStructure, but EFSMsgDataEnvelope is currently
-            // used by assuming that it reads also the content-type of
-            // the message
-            SetStructureL( cEntry, *result );
-
-            if ( store )
-                {
-                CleanupStack::PopAndDestroy( store );
-                }
-            CleanupStack::PopAndDestroy( cEntry );
+				SetEnvelopeL( cEntry, store, *result );
+	
+				// Apparently, this should be done only with
+				// EFSMsgDataStructure, but EFSMsgDataEnvelope is currently
+				// used by assuming that it reads also the content-type of
+				// the message
+				SetStructureL( cEntry, *result );
+	
+				if ( store )
+					{
+					CleanupStack::PopAndDestroy( store );
+					}
+				CleanupStack::PopAndDestroy( cEntry );
+            	}
             break;
             }
         case EFSMsgDataIdOnly:
@@ -1361,9 +1364,10 @@
             }
         result->SetMailBoxId( aMailBoxId );
         CleanupStack::PopAndDestroy(store);
+        
+        SetFetchStateL( aEntry, aMessageId.Id(), ETrue, *result );
         CleanupStack::Pop( result );
         }
-    SetFetchStateL( aEntry, aMessageId.Id(), ETrue, *result );
     CleanupStack::PopAndDestroy( cEntry );
 
     return result;