return;
cache.SetGAIANameOfProfileAtIndex(profile_index, full_name);
- cache.SetGAIAGivenNameOfProfileAtIndex(profile_index, given_name);
+ // The profile index may have changed.
+ profile_index = cache.GetIndexOfProfileWithPath(profile_->GetPath());
+ DCHECK_NE(profile_index, std::string::npos);
+ cache.SetGAIAGivenNameOfProfileAtIndex(profile_index, given_name);
// The profile index may have changed.
profile_index = cache.GetIndexOfProfileWithPath(profile_->GetPath());
- if (profile_index == std::string::npos)
- return;
+ DCHECK_NE(profile_index, std::string::npos);
+
if (picture_status == ProfileDownloader::PICTURE_SUCCESS) {
profile_->GetPrefs()->SetString(prefs::kProfileGAIAInfoPictureURL,
picture_url);