Skip to content

Commit e0a9011

Browse files
authored
Merge pull request #99 from github/early_return_if_undefined_tab
Return early if tab or panel are undefined
2 parents 98f5d77 + 13de837 commit e0a9011

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/tab-container-element.ts

+3
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,9 @@ export class TabContainerElement extends HTMLElement {
373373
const selectedTab = tabs[index]
374374
const selectedPanel = panels[index]
375375

376+
if (!selectedTab) return
377+
if (!selectedPanel) return
378+
376379
if (this.#setupComplete) {
377380
const cancelled = !this.dispatchEvent(
378381
new TabContainerChangeEvent('tab-container-change', {

0 commit comments

Comments
 (0)