Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1966)

Unified Diff: chrome/browser/profiles/profile_info_cache.cc

Issue 10453020: fix crash when double-deleting a profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/options2/browser_options.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_info_cache.cc
diff --git a/chrome/browser/profiles/profile_info_cache.cc b/chrome/browser/profiles/profile_info_cache.cc
index 80bfcd9490f97a012742bbec9c9d94041e3b402a..347254da18483498814d158324c918e98627485c 100644
--- a/chrome/browser/profiles/profile_info_cache.cc
+++ b/chrome/browser/profiles/profile_info_cache.cc
@@ -225,8 +225,12 @@ void ProfileInfoCache::RemoveObserver(ProfileInfoCacheObserver* obs) {
}
void ProfileInfoCache::DeleteProfileFromCache(const FilePath& profile_path) {
- string16 name = GetNameOfProfileAtIndex(
- GetIndexOfProfileWithPath(profile_path));
+ size_t profile_index = GetIndexOfProfileWithPath(profile_path);
+ if (profile_index == std::string::npos) {
+ NOTREACHED();
sail 2012/05/28 18:45:07 Hm... I don't think this NOTREACHED() is going to
Evan Stade 2012/05/29 18:12:13 this seems safer in case the code ever changes, so
sail 2012/05/29 18:38:21 makes sense!
+ return;
+ }
+ string16 name = GetNameOfProfileAtIndex(profile_index);
FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
observer_list_,
« no previous file with comments | « no previous file | chrome/browser/resources/options2/browser_options.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698