diff -r 502e5d91ad42 -r 15e4dd19031c idlefw/plugins/profileplugin/src/caiprofileengine.cpp --- a/idlefw/plugins/profileplugin/src/caiprofileengine.cpp Mon Mar 15 12:41:53 2010 +0200 +++ b/idlefw/plugins/profileplugin/src/caiprofileengine.cpp Wed Mar 31 22:04:35 2010 +0300 @@ -215,26 +215,35 @@ TInt generalProfileIndex( profileNamesArray->FindById( KGeneralProfileId ) ); - swapProfileName = - profileNamesArray->MdcaPoint( generalProfileIndex ).AllocLC() ; + if( generalProfileIndex > KErrNotFound ) + { + swapProfileName = + profileNamesArray->MdcaPoint( generalProfileIndex ).AllocLC() ; + } } else { TInt silentProfileIndex( profileNamesArray->FindById( KSilentProfileId ) ); - swapProfileName = - profileNamesArray->MdcaPoint( silentProfileIndex ).AllocLC() ; + if( silentProfileIndex > KErrNotFound ) + { + swapProfileName = + profileNamesArray->MdcaPoint( silentProfileIndex ).AllocLC() ; + } } - TPtrC swapProfileNamePtr( *swapProfileName ); - - HBufC* activateProfileString( StringLoader::LoadLC( - R_AI_PERS_PROF_TOGGLE, swapProfileNamePtr ) ); - - SetSwapProfileNameL( *activateProfileString ); + if( swapProfileName ) + { + HBufC* activateProfileString( StringLoader::LoadLC( + R_AI_PERS_PROF_TOGGLE, swapProfileName->Des() ) ); + + SetSwapProfileNameL( *activateProfileString ); + + CleanupStack::PopAndDestroy( 2 ); // swapProfileName, activateProfileString + } - CleanupStack::PopAndDestroy( 5 ); //profile, profileName, // profileNamesArray, swapProfileName, activateProfileString + CleanupStack::PopAndDestroy( 3 ); //profile, profileName, profileNamesArray, } // ----------------------------------------------------------------------------