chrome: Fix crash when clicking Reading List sidebar link (fixes issue #3128)

This commit is contained in:
Marshall Greenblatt 2022-01-14 13:52:56 -05:00
parent 9276dba712
commit 51e8bd9bd8
1 changed files with 8 additions and 0 deletions

View File

@ -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)) {