| Index: chrome/browser/ui/webui/options/password_manager_handler.cc
|
| diff --git a/chrome/browser/ui/webui/options/password_manager_handler.cc b/chrome/browser/ui/webui/options/password_manager_handler.cc
|
| index d4abf491c5a2bfa153b3626da27b8aba19416bca..03da07e73803aee14f5364b9e46f6a5dca8f4ca6 100644
|
| --- a/chrome/browser/ui/webui/options/password_manager_handler.cc
|
| +++ b/chrome/browser/ui/webui/options/password_manager_handler.cc
|
| @@ -27,7 +27,9 @@ PasswordManagerHandler::PasswordManagerHandler()
|
| }
|
|
|
| PasswordManagerHandler::~PasswordManagerHandler() {
|
| - GetPasswordStore()->RemoveObserver(this);
|
| + PasswordStore* store = GetPasswordStore();
|
| + if (store)
|
| + store->RemoveObserver(this);
|
| }
|
|
|
| void PasswordManagerHandler::GetLocalizedValues(
|
| @@ -74,7 +76,9 @@ void PasswordManagerHandler::Initialize() {
|
| show_passwords_.Init(prefs::kPasswordManagerAllowShowPasswords,
|
| web_ui_->GetProfile()->GetPrefs(), this);
|
| // We should not cache web_ui_->GetProfile(). See crosbug.com/6304.
|
| - GetPasswordStore()->AddObserver(this);
|
| + PasswordStore* store = GetPasswordStore();
|
| + if (store)
|
| + store->AddObserver(this);
|
| }
|
|
|
| void PasswordManagerHandler::RegisterMessages() {
|
| @@ -125,19 +129,25 @@ void PasswordManagerHandler::UpdatePasswordLists(const ListValue* args) {
|
| }
|
|
|
| void PasswordManagerHandler::RemoveSavedPassword(const ListValue* args) {
|
| + PasswordStore* store = GetPasswordStore();
|
| + if (!store)
|
| + return;
|
| std::string string_value = UTF16ToUTF8(ExtractStringValue(args));
|
| int index;
|
| base::StringToInt(string_value, &index);
|
| - GetPasswordStore()->RemoveLogin(*password_list_[index]);
|
| + store->RemoveLogin(*password_list_[index]);
|
| }
|
|
|
| void PasswordManagerHandler::RemovePasswordException(
|
| const ListValue* args) {
|
| + PasswordStore* store = GetPasswordStore();
|
| + if (!store)
|
| + return;
|
| std::string string_value = UTF16ToUTF8(ExtractStringValue(args));
|
| int index;
|
| base::StringToInt(string_value, &index);
|
|
|
| - GetPasswordStore()->RemoveLogin(*password_exception_list_[index]);
|
| + store->RemoveLogin(*password_exception_list_[index]);
|
| }
|
|
|
| void PasswordManagerHandler::RemoveAllSavedPasswords(
|
| @@ -145,6 +155,8 @@ void PasswordManagerHandler::RemoveAllSavedPasswords(
|
| // TODO(jhawkins): This will cause a list refresh for every password in the
|
| // list. Add PasswordStore::RemoveAllLogins().
|
| PasswordStore* store = GetPasswordStore();
|
| + if (!store)
|
| + return;
|
| for (size_t i = 0; i < password_list_.size(); ++i)
|
| store->RemoveLogin(*password_list_[i]);
|
| }
|
| @@ -152,6 +164,8 @@ void PasswordManagerHandler::RemoveAllSavedPasswords(
|
| void PasswordManagerHandler::RemoveAllPasswordExceptions(
|
| const ListValue* args) {
|
| PasswordStore* store = GetPasswordStore();
|
| + if (!store)
|
| + return;
|
| for (size_t i = 0; i < password_exception_list_.size(); ++i)
|
| store->RemoveLogin(*password_exception_list_[i]);
|
| }
|
|
|