Skip to content

Commit 6e130eb

Browse files
authored
Merge pull request #306 from serebrov/305-fix-error-on-scroll-top-access
[#305] Exit early from the scroll handler if scroll element is not available.
2 parents 70426f3 + bb5e156 commit 6e130eb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/utils/picker.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ export class PickerView {
2828

2929
onScroll() {
3030
const scrollElement = this._vm.$refs.scroll
31+
32+
if (!scrollElement) {
33+
// Reported in https://github.com/serebrov/emoji-mart-vue/issues/305
34+
// Would be good to understand how it can happen, but at least
35+
// exiting early we prevent the error.
36+
return
37+
}
38+
3139
const scrollTop = scrollElement.scrollTop
3240

3341
let activeCategory = this.filteredCategories[0]

0 commit comments

Comments
 (0)