From af1b6575723beada0ccc28fcc2fde5fc25ee9b26 Mon Sep 17 00:00:00 2001 From: Sean Date: Fri, 21 Jul 2017 14:54:12 -0700 Subject: [PATCH] Don't attempt to access an item at a negative index --- src/modules/Dropdown.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/Dropdown.vue b/src/modules/Dropdown.vue index a4ecc93..d4d27ef 100644 --- a/src/modules/Dropdown.vue +++ b/src/modules/Dropdown.vue @@ -401,6 +401,9 @@ Ignoring item: `, item) return !Array.isArray(instance) && instance === Object(instance) }, scrollIntoView(pos) { + if (pos < 0) { + return + } var el = this.$refs.items[pos] var items = Math.floor(el.offsetParent.offsetHeight / el.offsetHeight) var scrollFixer = pos - items; @@ -420,4 +423,4 @@ Ignoring item: `, item) } }, } - \ No newline at end of file +