mtpdataproviders/mtpimagedp/src/cmtpimagedpgetthumb.cpp
branchRCL_3
changeset 45 74aa6861c87d
parent 43 4a793f564d72
child 58 142dacf7b30e
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetthumb.cpp	Wed Sep 01 12:20:56 2010 +0100
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetthumb.cpp	Tue Sep 14 22:52:29 2010 +0300
@@ -111,21 +111,26 @@
         TEntry fileEntry;
         
         User::LeaveIfError(iFramework.Fs().Entry(iObjectMeta->DesC(CMTPObjectMetaData::ESuid), fileEntry));
-        imgDp.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags);
-        if(fileEntry.FileSize() > KFileSizeMax)
+        
+        CMTPImageDpThumbnailCreator* tnc = imgDp.ThumbnailManager();
+        if(tnc != NULL)
             {
-            __FLOG(_L8(">> CMTPImageDpGetThumb::ServiceL, fileEntry.FileSize() > KFileSizeMax"));
-            imgDp.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate);
+            tnc->GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags);
+            if(fileEntry.FileSize() > KFileSizeMax)
+                {
+                __FLOG(_L8(">> CMTPImageDpGetThumb::ServiceL, fileEntry.FileSize() > KFileSizeMax"));
+                tnc->GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate);
+                }
+            
+            tnc->GetThumbnailL(iObjectMeta->DesC(CMTPObjectMetaData::ESuid), thumbnailData, err);
+            imgDp.PropertyMgr().StoreThunmnail(iObjectMeta->Uint(CMTPObjectMetaData::EHandle), thumbnailData);
             }
-        
-        imgDp.ThumbnailManager().GetThumbnailL(iObjectMeta->DesC(CMTPObjectMetaData::ESuid), thumbnailData, err);
-        User::LeaveIfError(err);
-        User::LeaveIfNull(thumbnailData);
-        
-        //Transfer ownership of thumbnailData to Property Manager
-        imgDp.PropertyMgr().StoreThunmnail(iObjectMeta->Uint(CMTPObjectMetaData::EHandle), thumbnailData);
+        //Transfer ownership of thumbnailData to Property Manager       
         }
-    iThumb->Write(*thumbnailData);
+    if(thumbnailData != NULL)
+        {
+        iThumb->Write(*thumbnailData);
+        }
     SendDataL(*iThumb);
     __FLOG(_L8("<< CMTPImageDpGetThumb::ServiceL"));
     }