Commit e7ad7cf6 authored by David Stutz's avatar David Stutz

Merge pull request #319 from Tyf0x/fix_#282

** fix for #282: prevent crash when trying to select non-existant value **
parents 0ba78e65 e762fc7c
...@@ -750,6 +750,11 @@ ...@@ -750,6 +750,11 @@
var $option = this.getOptionByValue(value); var $option = this.getOptionByValue(value);
var $checkbox = this.getInputByValue(value); var $checkbox = this.getInputByValue(value);
if($option === void(0) || $checkbox === void(0))
{
continue;
}
if (this.options.selectedClass) { if (this.options.selectedClass) {
$checkbox.parents('li') $checkbox.parents('li')
.addClass(this.options.selectedClass); .addClass(this.options.selectedClass);
...@@ -789,6 +794,11 @@ ...@@ -789,6 +794,11 @@
var $option = this.getOptionByValue(value); var $option = this.getOptionByValue(value);
var $checkbox = this.getInputByValue(value); var $checkbox = this.getInputByValue(value);
if($option === void(0) || $checkbox === void(0))
{
continue;
}
if (this.options.selectedClass) { if (this.options.selectedClass) {
$checkbox.parents('li') $checkbox.parents('li')
.removeClass(this.options.selectedClass); .removeClass(this.options.selectedClass);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment