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

Unified Diff: third_party/WebKit/Source/modules/credentialmanager/CredentialsContainer.cpp

Issue 2850813004: Add a nullptr check in blink::RequestCallbacks::onSuccess to fix crash. (Closed)
Patch Set: rebase Created 3 years, 8 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
Index: third_party/WebKit/Source/modules/credentialmanager/CredentialsContainer.cpp
diff --git a/third_party/WebKit/Source/modules/credentialmanager/CredentialsContainer.cpp b/third_party/WebKit/Source/modules/credentialmanager/CredentialsContainer.cpp
index 5198c3f8c0f4822768cf0ffeb5ab9d7cfa277eae..0a703fccdfe38973451129bb681319aa15733bba 100644
--- a/third_party/WebKit/Source/modules/credentialmanager/CredentialsContainer.cpp
+++ b/third_party/WebKit/Source/modules/credentialmanager/CredentialsContainer.cpp
@@ -90,9 +90,11 @@ class RequestCallbacks : public WebCredentialManagerClient::RequestCallbacks {
~RequestCallbacks() override {}
void OnSuccess(std::unique_ptr<WebCredential> web_credential) override {
- Frame* frame =
- ToDocument(ExecutionContext::From(resolver_->GetScriptState()))
- ->GetFrame();
+ ExecutionContext* context =
+ ExecutionContext::From(resolver_->GetScriptState());
+ if (!context)
+ return;
+ Frame* frame = ToDocument(context)->GetFrame();
SECURITY_CHECK(!frame || frame == frame->Tree().Top());
std::unique_ptr<WebCredential> credential =

Powered by Google App Engine
This is Rietveld 408576698