Skip to content

Commit

Permalink
fix: error on pressing the key Enter when items is empty.
Browse files Browse the repository at this point in the history
ERROR TypeError: Cannot read property 'disabled' of undefined
    at NgxSelectComponent.optionSelect (ngx-select.component.ts:353)
  • Loading branch information
optimistex committed Feb 15, 2018
1 parent d2d7857 commit fe79b3a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/app/lib/ngx-select/ngx-select.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ export class NgxSelectComponent implements ControlValueAccessor, DoCheck, AfterC
event.preventDefault();
event.stopPropagation();
}
if (!option.disabled) {
if (option && !option.disabled) {
this.subjOptionsSelected.next((this.multiple ? this.subjOptionsSelected.value : []).concat([option]));
this.select.emit(option.value);
this.optionsClose(true);
Expand Down

0 comments on commit fe79b3a

Please sign in to comment.