Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6032)

Unified Diff: chrome/browser/dom_ui/options/autofill_options_handler.cc

Issue 6323012: DOMUI: Gracefully a handle a NULL profile in the Autofill editor handler. This (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dom_ui/options/autofill_options_handler.cc
diff --git a/chrome/browser/dom_ui/options/autofill_options_handler.cc b/chrome/browser/dom_ui/options/autofill_options_handler.cc
index d82982ba4e64131c3d200dd62cc16c0385479c71..3f82e536b46f5b061e90978235c4d52e7fbec684 100644
--- a/chrome/browser/dom_ui/options/autofill_options_handler.cc
+++ b/chrome/browser/dom_ui/options/autofill_options_handler.cc
@@ -241,7 +241,14 @@ void AutoFillOptionsHandler::LoadAddressEditor(const ListValue* args) {
}
AutoFillProfile* profile = personal_data_->GetProfileByGUID(guid);
- DCHECK(profile);
+ if (!profile) {
+ // There is a race where a user can click once on the close button and
+ // quickly click again on the list item before the item is removed (since
+ // the list is not updated until the model tells the list an item has been
+ // removed). This will activate the editor for a profile that has been
+ // removed. Do nothing in that case.
+ return;
+ }
// TODO(jhawkins): This is hacky because we can't send DictionaryValue
// directly to CallJavascriptFunction().
@@ -288,7 +295,14 @@ void AutoFillOptionsHandler::LoadCreditCardEditor(const ListValue* args) {
}
CreditCard* credit_card = personal_data_->GetCreditCardByGUID(guid);
- DCHECK(credit_card);
+ if (!credit_card) {
+ // There is a race where a user can click once on the close button and
+ // quickly click again on the list item before the item is removed (since
+ // the list is not updated until the model tells the list an item has been
+ // removed). This will activate the editor for a profile that has been
+ // removed. Do nothing in that case.
+ return;
+ }
// TODO(jhawkins): This is hacky because we can't send DictionaryValue
// directly to CallJavascriptFunction().
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698