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

Unified Diff: chrome/browser/ui/login/login_handler.cc

Issue 2460323002: Avoid nullptr deref when requesting http auth for non-webcontents requests (Closed)
Patch Set: Created 4 years, 1 month 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/ui/login/login_handler.cc
diff --git a/chrome/browser/ui/login/login_handler.cc b/chrome/browser/ui/login/login_handler.cc
index d9330b5bb064cf9a416fc83ad803dd1ebc343007..ad085a9c2db4e25271c6c98e4e06d8e48c22deaf 100644
--- a/chrome/browser/ui/login/login_handler.cc
+++ b/chrome/browser/ui/login/login_handler.cc
@@ -116,14 +116,14 @@ LoginHandler::LoginHandler(net::AuthChallengeInfo* auth_info,
AddRef(); // matched by LoginHandler::ReleaseSoon().
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- base::Bind(&LoginHandler::AddObservers, this));
-
const content::ResourceRequestInfo* info =
ResourceRequestInfo::ForRequest(request);
DCHECK(info);
web_contents_getter_ = info->GetWebContentsGetterForRequest();
+
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ base::Bind(&LoginHandler::AddObservers, this));
}
void LoginHandler::OnRequestCancelled() {
@@ -338,7 +338,9 @@ void LoginHandler::AddObservers() {
content::NotificationService::AllBrowserContextsAndSources());
#if !defined(OS_ANDROID)
- dialog_helper_.reset(new AppModalDialogHelper(GetWebContentsForLogin()));
+ WebContents* requesting_contents = GetWebContentsForLogin();
+ if (requesting_contents)
+ dialog_helper_.reset(new AppModalDialogHelper(requesting_contents));
#endif
}
« 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