0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 18:32:41 +00:00

prevent crash if desired attr is not available.

This commit is contained in:
Gazook89
2022-11-29 12:25:58 -06:00
parent 9e289ad6d1
commit 76d73e0e02

View File

@@ -87,9 +87,9 @@ const Combobox = createClass({
const filteredArrays = filterOn.map((attr)=>{
const children = dropdownChildren.filter((item)=>{
if(suggestMethod === 'includes'){
return item.props[attr].toLowerCase().includes(this.state.value.toLowerCase());
return item.props[attr]?.toLowerCase().includes(this.state.value.toLowerCase());
} else if(suggestMethod === 'startsWith'){
return item.props[attr].toLowerCase().startsWith(this.state.value.toLowerCase());
return item.props[attr]?.toLowerCase().startsWith(this.state.value.toLowerCase());
}
});
return children;