From f3796e29644ba517e443ed46dcffca97c7d2d249 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Thu, 16 Jan 2020 11:18:28 +0100 Subject: [PATCH] Fix crash due to NULL frame during navigation (fixes issue #2772) --- libcef/browser/browser_host_impl.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libcef/browser/browser_host_impl.cc b/libcef/browser/browser_host_impl.cc index 9011cd0c9..a9378f2d7 100644 --- a/libcef/browser/browser_host_impl.cc +++ b/libcef/browser/browser_host_impl.cc @@ -2621,8 +2621,18 @@ void CefBrowserHostImpl::DidFinishNavigation( const GURL& url = (error_code == net::OK ? navigation_handle->GetURL() : GURL()); + // May return NULL when starting a new navigation if the previous navigation + // caused the renderer process to crash during load. CefRefPtr frame = browser_info_->GetFrameForFrameTreeNode( navigation_handle->GetFrameTreeNodeId()); + if (!frame) { + if (is_main_frame) { + frame = browser_info_->GetMainFrame(); + } else { + frame = + browser_info_->CreateTempSubFrame(CefFrameHostImpl::kInvalidFrameId); + } + } frame->RefreshAttributes(); if (error_code == net::OK) {