From 13de8370b5afa79b12dace370c32b1dfa1889e2a Mon Sep 17 00:00:00 2001 From: Cameron Dutro Date: Thu, 20 Jun 2024 14:07:13 -0700 Subject: [PATCH] Return early if tab or panel are undefined --- src/tab-container-element.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tab-container-element.ts b/src/tab-container-element.ts index ebccbd9..2742175 100644 --- a/src/tab-container-element.ts +++ b/src/tab-container-element.ts @@ -362,6 +362,9 @@ export class TabContainerElement extends HTMLElement { const selectedTab = tabs[index] const selectedPanel = panels[index] + if (!selectedTab) return + if (!selectedPanel) return + if (this.#setupComplete) { const cancelled = !this.dispatchEvent( new TabContainerChangeEvent('tab-container-change', {