🍣 little bug fix

This commit is contained in:
Shiba 2022-07-07 17:37:57 +00:00
parent 1eb21eb51f
commit ce11d4fdf3

View file

@ -159,6 +159,7 @@ import { getExtensionSettingsAsync, getSourcePlatfromSettingsFromHostname, getTa
const url = new URL(location.href); const url = new URL(location.href);
let target = (await getTargetsByURL(url))[url.href] let target = (await getTargetsByURL(url))[url.href]
try {
if (settings.redirect) { if (settings.redirect) {
if (!target) continue if (!target) continue
if (url === urlCache) continue if (url === urlCache) continue
@ -189,6 +190,7 @@ import { getExtensionSettingsAsync, getSourcePlatfromSettingsFromHostname, getTa
const anchors = Array.from(descriptionElement.querySelectorAll<HTMLAnchorElement>('a')) const anchors = Array.from(descriptionElement.querySelectorAll<HTMLAnchorElement>('a'))
for (const anchor of anchors) { for (const anchor of anchors) {
if (!anchor.href) continue
const url = new URL(anchor.href) const url = new URL(anchor.href)
let lbryURL: URL | null = null let lbryURL: URL | null = null
if (sourcePlatform === sourcePlatfromSettings['youtube.com']) { if (sourcePlatform === sourcePlatfromSettings['youtube.com']) {
@ -221,7 +223,9 @@ import { getExtensionSettingsAsync, getSourcePlatfromSettingsFromHostname, getTa
// We run it anyway with null target to hide the button // We run it anyway with null target to hide the button
updateButton(target) updateButton(target)
} }
} catch (error) {
console.error(error)
}
urlCache = url urlCache = url
} }