Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / profiles / gaia_info_update_service.cc
index 6e79b85..a68006b 100644 (file)
@@ -118,12 +118,15 @@ void GAIAInfoUpdateService::OnProfileDownloadSuccess(
     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);