Skip to content

Commit

Permalink
fix JS error thrown when trying to get position0 in createView (cause…
Browse files Browse the repository at this point in the history
…d by menuInnerHeight being a negative number). #2198
  • Loading branch information
caseyjhol committed Feb 13, 2019
1 parent 63be0b9 commit c5bd757
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion js/bootstrap-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -1795,7 +1795,8 @@
'min-height': menuInnerMinHeight + 'px'
});

this.sizeInfo.menuInnerHeight = menuInnerHeight;
// ensure menuInnerHeight is always a positive number to prevent issues calculating chunkSize in createView
this.sizeInfo.menuInnerHeight = Math.max(menuInnerHeight, 1);

if (this.selectpicker.current.data.length && this.selectpicker.current.data[this.selectpicker.current.data.length - 1].position > this.sizeInfo.menuInnerHeight) {
this.sizeInfo.hasScrollBar = true;
Expand Down

0 comments on commit c5bd757

Please sign in to comment.