realtimenetprots/sipfw/ProfileAgent/Store/Src/SIPProfileStorageIndex.cpp
changeset 55 36ea1f90a3d8
parent 0 307788aac0a8
--- a/realtimenetprots/sipfw/ProfileAgent/Store/Src/SIPProfileStorageIndex.cpp	Tue Oct 19 05:33:24 2010 +0530
+++ b/realtimenetprots/sipfw/ProfileAgent/Store/Src/SIPProfileStorageIndex.cpp	Thu Oct 21 15:53:21 2010 +0530
@@ -198,10 +198,16 @@
 	TUint32 profileID = iProfileIdArray.Count()+1;
 	
 	iProfileIdArray.SortUnsigned();
-	for (TUint32 i = 0; i < iProfileIdArray.Count(); i++)
+	TInt profilescount;
+	if(iCore->GetProfileCacheCount() > iProfileIdArray.Count())
+	    profilescount = iCore->GetProfileCacheCount();
+	else
+	    profilescount = iProfileIdArray.Count();
+	
+	for (TUint32 i = 0; i <profilescount ; i++)
 	    {
 	    TRAPD(err, iCore->ProfileCacheItemL(i+1));
-	    if (i+1 != iProfileIdArray[i] && KErrNotFound == err)
+	    if(KErrNotFound == err && !ProfileExists(i+1))
 	        {
 	        profileID = i+1;
 	        break;