From 2b002584074c669125f176799474f191d0fb2ba4 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Fri, 14 Jan 2022 13:52:56 -0500 Subject: [PATCH] chrome: Fix crash when clicking Reading List sidebar link (fixes issue #3128) --- libcef/browser/chrome/chrome_browser_delegate.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libcef/browser/chrome/chrome_browser_delegate.cc b/libcef/browser/chrome/chrome_browser_delegate.cc index f0b490565..1994692ea 100644 --- a/libcef/browser/chrome/chrome_browser_delegate.cc +++ b/libcef/browser/chrome/chrome_browser_delegate.cc @@ -135,6 +135,14 @@ void ChromeBrowserDelegate::AddNewContents( content::WebContents* ChromeBrowserDelegate::OpenURLFromTab( content::WebContents* source, const content::OpenURLParams& params) { + // |source| may be nullptr when opening a link from chrome UI such as the + // Reading List sidebar. In that case we default to using the Browser's + // currently active WebContents. + if (!source) { + source = browser_->tab_strip_model()->GetActiveWebContents(); + DCHECK(source); + } + // Return nullptr to cancel the navigation. Otherwise, proceed with default // chrome handling. if (auto delegate = GetDelegateForWebContents(source)) {