From 09b3eed582a14f4e5e5954a94a57d7b809460c03 Mon Sep 17 00:00:00 2001 From: Bilux Date: Thu, 8 Dec 2022 05:29:04 +0100 Subject: [PATCH] fix(combobox): avoid runtime error if `items` is empty (#1545) --- src/ComboBox/ComboBox.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ComboBox/ComboBox.svelte b/src/ComboBox/ComboBox.svelte index cb2bdd78..886cc433 100644 --- a/src/ComboBox/ComboBox.svelte +++ b/src/ComboBox/ComboBox.svelte @@ -127,6 +127,7 @@ function change(dir) { let index = highlightedIndex + dir; let _items = !filteredItems?.length ? items : filteredItems; + if (_items.length === 0) return; if (index < 0) { index = _items.length - 1; } else if (index >= _items.length) {