Skip to content

Commit

Permalink
fix snapappointments#2092 check existence of select options before ac…
Browse files Browse the repository at this point in the history
…cessing property 'className'
  • Loading branch information
Mobe91 committed Sep 7, 2018
1 parent 9b50d93 commit 62a3eac
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 @@ -1441,7 +1441,8 @@
this.sizeInfo.selectWidth = this.$newElement[0].offsetWidth;

text.className = 'text';
a.className = 'dropdown-item ' + this.$element.find('option')[0].className;
var optionElements = this.$element.find('option');
a.className = 'dropdown-item ' + (optionElements.length === 0 ? '' : optionElements[0].className);
newElement.className = this.$menu[0].parentNode.className + ' ' + classNames.SHOW;
newElement.style.width = this.sizeInfo.selectWidth + 'px';
if (this.options.width === 'auto') menu.style.minWidth = 0;
Expand Down

0 comments on commit 62a3eac

Please sign in to comment.