diff --git a/app/filtering.js b/app/filtering.js index cea4f1bc134..b817144b007 100644 --- a/app/filtering.js +++ b/app/filtering.js @@ -863,11 +863,15 @@ module.exports.getMainFrameUrl = (details) => { if (details.resourceType === 'mainFrame') { return details.url } + let url = null const tab = webContents.fromTabID(details.tabId) - try { - return tab.getURL() - } catch (ex) {} - return details.firstPartyUrl || null + if (tab && !tab.isDestroyed()) { + url = tab.getURL() + } + if (!url && details.firstPartyUrl) { + url = details.firstPartyUrl + } + return url } module.exports.alwaysAllowFullscreen = () => {