Index: chrome/browser/ui/views/profiles/profile_chooser_view.cc |
diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view.cc b/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
index 67f33223a1c6ec82a2327fa09ff2522d6d315730..01f317200324a357f284fc6a66789232b455a1b5 100644 |
--- a/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
+++ b/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
@@ -97,17 +97,20 @@ gfx::ImageSkia CreateSquarePlaceholderImage(int size) { |
return gfx::ImageSkia::CreateFrom1xBitmap(bitmap); |
} |
+// Note that guest mode profiles won't have a token service. |
+const SigninErrorController* GetSigninErrorController(Profile* profile) { |
+ const ProfileOAuth2TokenService* token_service = |
+ ProfileOAuth2TokenServiceFactory::GetForProfile(profile); |
+ return token_service ? token_service->signin_error_controller() : NULL; |
+} |
+ |
bool HasAuthError(Profile* profile) { |
- SigninErrorController* error = |
- ProfileOAuth2TokenServiceFactory::GetForProfile(profile)-> |
- signin_error_controller(); |
+ const SigninErrorController* error = GetSigninErrorController(profile); |
return error && error->HasError(); |
} |
std::string GetAuthErrorAccountId(Profile* profile) { |
- SigninErrorController* error = |
- ProfileOAuth2TokenServiceFactory::GetForProfile(profile)-> |
- signin_error_controller(); |
+ const SigninErrorController* error = GetSigninErrorController(profile); |
if (!error) |
return std::string(); |
@@ -115,9 +118,7 @@ std::string GetAuthErrorAccountId(Profile* profile) { |
} |
std::string GetAuthErrorUsername(Profile* profile) { |
- SigninErrorController* error = |
- ProfileOAuth2TokenServiceFactory::GetForProfile(profile)-> |
- signin_error_controller(); |
+ const SigninErrorController* error = GetSigninErrorController(profile); |
if (!error) |
return std::string(); |