Skip to content

Commit

Permalink
hedge against alarm not being defined
Browse files Browse the repository at this point in the history
  • Loading branch information
Step7750 committed Apr 4, 2024
1 parent 42cb685 commit 0d65aad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/utils/alarm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export async function setupCookieAlarm(initial = false) {
permissions: ['alarms', 'cookies'],
})) as boolean;

if (!granted) {
if (!granted || !chrome.alarms) {
return;
}

Expand All @@ -32,7 +32,7 @@ export async function setupCookieAlarm(initial = false) {
}

function createAlarmListener() {
chrome.alarms.onAlarm.addListener(async (alarm) => {
chrome.alarms?.onAlarm?.addListener(async (alarm) => {
if (alarm.name !== COOKIE_ALARM_NAME) {
return;
}
Expand Down

0 comments on commit 0d65aad

Please sign in to comment.