mtpfws/mtpfw/dataproviders/dputility/src/cmtpfsenumerator.cpp
branchRCL_3
changeset 18 453dfc402455
parent 15 f85613f12947
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpfsenumerator.cpp	Thu Jul 15 19:35:12 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpfsenumerator.cpp	Thu Aug 19 10:44:03 2010 +0300
@@ -396,18 +396,27 @@
 TInt CMTPFSEnumerator::RunError(TInt aError)
 	{
 	__FLOG_VA((_L8("RunError - entry with error %d"), aError));
-	 if(!iFramework.StorageMgr().ValidStorageId(iStorages[iScanPos]))
-		 {
-		 __FLOG_VA((_L8("Invalid StorageID = %d"),iStorages[iScanPos] ));
-		 if (iStorages.Count()>1)
-			 {
-			 //Not necessary to process any entry on the storage, since the storage removed.
-			 //Then need to start from root dir of next storage if there is.
-			 //So, the dir stack is popped to bottom.
-			 iDirStack.Reset();
-			 }
-		 iSkipCurrentStorage = ETrue;
-		 }
+	
+	// avoid to access overflow of iStorages
+    if (iScanPos < iStorages.Count())
+        {
+        if(!iFramework.StorageMgr().ValidStorageId(iStorages[iScanPos]))
+            {
+             __FLOG_VA((_L8("Invalid StorageID = %d"),iStorages[iScanPos] ));
+             if (iStorages.Count()>1)
+                 {
+                 //Not necessary to process any entry on the storage, since the storage removed.
+                 //Then need to start from root dir of next storage if there is.
+                 //So, the dir stack is popped to bottom.
+                 iDirStack.Reset();
+                 }
+             iSkipCurrentStorage = ETrue;
+            }
+        }
+    else
+        {
+        iSkipCurrentStorage = ETrue;
+        }
 	
 	// Reschedule ourselves
 	TRequestStatus* status = &iStatus;
@@ -548,10 +557,16 @@
                                 __FLOG_VA((_L("mime %S"), mime));
                                 DpId = iDpSingletons.MTPUtility().GetDpIdL(parse.Ext().Mid(1),*mime);
                                 __FLOG_VA((_L("DpId find %d"), DpId));
+								
+								format = iDpSingletons.MTPUtility().GetFormatCodeByMimeTypeL(parse.Ext().Mid(1),*mime);
+								AddFileEntryForOtherDpL(iCurrentPath, handle, format, DpId, entry, iStorages[iScanPos], 
+										iParentHandle, iDpSingletons.MTPUtility().GetSubFormatCodeL(parse.Ext().Mid(1),*mime));
                                 }
-                            format = iDpSingletons.MTPUtility().GetFormatCodeByMimeTypeL(parse.Ext().Mid(1),*mime);
-                            AddFileEntryForOtherDpL(iCurrentPath, handle, format, DpId, entry, iStorages[iScanPos], 
-                                    iParentHandle, iDpSingletons.MTPUtility().GetSubFormatCodeL(parse.Ext().Mid(1),*mime));
+							else
+                                {
+                                AddEntryL(iCurrentPath, handle, EMTPFormatCodeUndefined, iDpID, entry, iStorages[iScanPos], iParentHandle);
+                                }
+
                             CleanupStack::PopAndDestroy(mime);
                             }
                         else