Skip to content

Commit

Permalink
Check if option has data (#2160)
Browse files Browse the repository at this point in the history
  • Loading branch information
caseyjhol committed Dec 12, 2018
1 parent 88d13e5 commit c4da3af
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions js/bootstrap-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -1485,13 +1485,14 @@

for (var index = 0, len = $selectOptions.length; index < len; index++) {
var i = that.selectpicker.main.map.newIndex[index],
option = $selectOptions[index];
option = $selectOptions[index],
optionData = that.selectpicker.main.data[i] || that.selectpicker.main.hidden[index];

if (option && option.selected) {
if (option && option.selected && optionData) {
selectedItems.push(option);

if ((selectedItemsInTitle.length < 100 && that.options.selectedTextFormat !== 'count') || selectedItems.length === 1) {
var thisData = (that.selectpicker.main.data[i] || that.selectpicker.main.hidden[index]).data,
var thisData = optionData.data,
icon = thisData.icon && that.options.showIcon ? '<i class="' + that.options.iconBase + ' ' + thisData.icon + '"></i> ' : '',
subtext,
titleItem;
Expand Down

0 comments on commit c4da3af

Please sign in to comment.