fix(browser-extension): possible undefined

This commit is contained in:
wanhose 2024-10-11 19:00:30 +02:00
parent 539e1840b2
commit c4084458b2

View File

@ -104,7 +104,7 @@ const suppressLastError = () => void browser.runtime.lastError;
*/
async function enableIcon(hostname, tabId) {
const state = await getState(hostname);
const path = state.issue.url ? '/assets/icons/warn.png' : '/assets/icons/on.png';
const path = state.issue?.url ? '/assets/icons/warn.png' : '/assets/icons/on.png';
await browser.action.setIcon({ path, tabId }, suppressLastError);
}