Add CHECK in ProfileManager::GetActiveUserProfile() for rare crash

There's a rare crash in ChromeLauncherController that looks
like a user is switching into Ash with no profile and a
read-only profile directory. Add a CHECK to figure out how
common this problem is.

BUG=383019
TEST=none

Review URL: https://codereview.chromium.org/336603002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276868 0039d316-1c4b-4281-b951-d872f2087c98
parent 2944afa8
...@@ -342,8 +342,16 @@ Profile* ProfileManager::GetActiveUserProfile() { ...@@ -342,8 +342,16 @@ Profile* ProfileManager::GetActiveUserProfile() {
if (user && user->is_profile_created()) if (user && user->is_profile_created())
return manager->GetProfileByUser(user); return manager->GetProfileByUser(user);
#endif #endif
return profile_manager->GetActiveUserOrOffTheRecordProfileFromPath( Profile* profile =
profile_manager->user_data_dir()); profile_manager->GetActiveUserOrOffTheRecordProfileFromPath(
profile_manager->user_data_dir());
// |profile| could be null if the user doesn't have a profile yet and the path
// is on a read-only volume (preventing Chrome from making a new one).
// However, most callers of this function immediately dereference the result
// which would lead to crashes in a variety of call sites. Assert here to
// figure out how common this is. http://crbug.com/383019
CHECK(profile) << profile_manager->user_data_dir().AsUTF8Unsafe();
return profile;
} }
Profile* ProfileManager::GetProfile(const base::FilePath& profile_dir) { Profile* ProfileManager::GetProfile(const base::FilePath& profile_dir) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment