Skip to content

Commit d257dc6

Browse files
committed
fix undefined tab
1 parent 2581843 commit d257dc6

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

scripts/background.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,17 @@ function backgroundCheck() {
2323
activity.addTab(activeTab);
2424
}
2525

26-
chrome.idle.queryState(SETTINGS_INTERVAL_INACTIVITY, function (state) {
27-
if (state === 'active') {
28-
tab.summaryTime += 1;
29-
chrome.browserAction.setBadgeText({
30-
tabId: activeTab.id,
31-
text: String(convertSummaryTimeToBadgeString(tab.summaryTime))
32-
});
33-
}
34-
});
26+
if (tab !== undefined) {
27+
chrome.idle.queryState(SETTINGS_INTERVAL_INACTIVITY, function (state) {
28+
if (state === 'active') {
29+
tab.summaryTime += 1;
30+
chrome.browserAction.setBadgeText({
31+
tabId: activeTab.id,
32+
text: String(convertSummaryTimeToBadgeString(tab.summaryTime))
33+
});
34+
}
35+
});
36+
}
3537
}
3638
}
3739
});

0 commit comments

Comments
 (0)