Commit 86e4f0c4 authored by jam's avatar jam Committed by Commit bot

Fix crash when displaying a null certificate.

This regressed in r417444. Previously (https://codereview.chromium.org/2327433002/diff/250001/chrome/browser/certificate_viewer.cc) we would check that the certificate id sent by the renderer was valid (say because renderer died). Races could also happen now, in that the page might navigate right after user presses certificate viewer button and the last committed entry wouldn't have a certificate.

BUG=646882

Review-Url: https://codereview.chromium.org/2337783005
Cr-Commit-Position: refs/heads/master@{#418644}
parent 262a9e00
......@@ -156,6 +156,8 @@ Response SecurityHandler::ShowCertificateViewer() {
WebContents* web_contents = WebContents::FromRenderFrameHost(host_);
scoped_refptr<net::X509Certificate> certificate = web_contents->
GetController().GetLastCommittedEntry()->GetSSL().certificate;
if (!certificate)
return Response::InternalError("Could not find certificate");
web_contents->GetDelegate()->ShowCertificateViewerInDevTools(
web_contents, certificate);
return Response::OK();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment