diff -r e4420734a2a0 -r 36ea1f90a3d8 realtimenetprots/sipfw/ProfileAgent/Store/Src/SIPProfileStorageIndex.cpp --- 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 ProfileCacheItemL(i+1)); - if (i+1 != iProfileIdArray[i] && KErrNotFound == err) + if(KErrNotFound == err && !ProfileExists(i+1)) { profileID = i+1; break;