Fixed #5140 - Search with null/undefined values breaks rendering

This commit is contained in:
tugcekucukoglu 2024-01-24 14:54:14 +03:00
parent 2501fc91b7
commit ea75e45b3f
10 changed files with 10 additions and 10 deletions

View file

@ -760,7 +760,7 @@ export default {
return DomHandler.getFocusableElements(this.overlay, ':not([data-p-hidden-focusable="true"])').length > 0;
},
isOptionMatched(option) {
return this.isValidOption(option) && this.getOptionLabel(option).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale));
return this.isValidOption(option) && this.getOptionLabel(option)?.toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale));
},
isValidOption(option) {
return ObjectUtils.isNotEmpty(option) && !(this.isOptionDisabled(option) || this.isOptionGroup(option));