fix: check filteredItems length before unsafe index access

This commit is contained in:
Aryan Kothari 2024-07-24 09:06:21 -04:00
parent dbf88a2eca
commit fbef731a04

View File

@ -243,7 +243,7 @@
placeholder={searchPlaceholder}
autocomplete="off"
on:keydown={(e) => {
if (e.code === 'Enter') {
if (e.code === 'Enter' && filteredItems.length > 0) {
value = filteredItems[selectedModelIdx].value;
show = false;
return; // dont need to scroll on selection