fix(dropdown): avoid runtime error if items is empty (#1578)

This commit is contained in:
metonym 2022-12-07 20:38:22 -08:00 committed by GitHub
commit fce92fb648
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -121,6 +121,7 @@
function change(dir) {
let index = highlightedIndex + dir;
if (items.length === 0) return;
if (index < 0) {
index = items.length - 1;
} else if (index >= items.length) {