Skip to content

Commit 5431639

Browse files
added length to avoid error (GoogleChrome#892)
check tabIds.length avoid error
1 parent ba108bf commit 5431639

File tree

1 file changed

+4
-2
lines changed
  • functional-samples/tutorial.tabs-manager

1 file changed

+4
-2
lines changed

functional-samples/tutorial.tabs-manager/popup.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ document.querySelector('ul').append(...elements);
4646
const button = document.querySelector('button');
4747
button.addEventListener('click', async () => {
4848
const tabIds = tabs.map(({ id }) => id);
49-
const group = await chrome.tabs.group({ tabIds });
50-
await chrome.tabGroups.update(group, { title: 'DOCS' });
49+
if (tabIds.length) {
50+
const group = await chrome.tabs.group({ tabIds });
51+
await chrome.tabGroups.update(group, { title: 'DOCS' });
52+
}
5153
});

0 commit comments

Comments
 (0)