Index: chrome/browser/signin/about_signin_internals.cc |
diff --git a/chrome/browser/signin/about_signin_internals.cc b/chrome/browser/signin/about_signin_internals.cc |
index e75d3ef53c9a436cd90e1aa04ea566a708adbc68..e58570ece5e7aa421251defbd9694ad1575b91d6 100644 |
--- a/chrome/browser/signin/about_signin_internals.cc |
+++ b/chrome/browser/signin/about_signin_internals.cc |
@@ -204,10 +204,15 @@ void AboutSigninInternals::Initialize(Profile* profile) { |
} |
void AboutSigninInternals::Shutdown() { |
- SigninManagerFactory::GetForProfile(profile_)-> |
- RemoveSigninDiagnosticsObserver(this); |
- TokenServiceFactory::GetForProfile(profile_)-> |
- RemoveSigninDiagnosticsObserver(this); |
+ SigninManager* signin = SigninManagerFactory::GetForProfile(profile_); |
+ // Some unit tests do stuff like switching profiles to incognito in mid-test, |
+ // so there may not always be |
+ if (signin) |
+ signin->RemoveSigninDiagnosticsObserver(this); |
+ |
+ TokenService* token = TokenServiceFactory::GetForProfile(profile_); |
+ if (token) |
+ token->RemoveSigninDiagnosticsObserver(this); |
} |
void AboutSigninInternals::NotifyObservers() { |