Fixed itemAllowedInContainer() failing when the filter or excluded filter objects are null

This commit is contained in:
Dev 2024-04-14 19:32:11 +01:00
parent 0d6239ea42
commit d31eedf92b

View File

@ -688,13 +688,13 @@ export class BotGeneratorHelper
const itemDetails = this.itemHelper.getItem(itemTpl)[1]; const itemDetails = this.itemHelper.getItem(itemTpl)[1];
// if item to add is found in exclude filter, not allowed // if item to add is found in exclude filter, not allowed
if (excludedFilter.includes(itemDetails._parent)) if (excludedFilter?.includes(itemDetails._parent))
{ {
return false; return false;
} }
// If Filter array only contains 1 filter and its for basetype 'item', allow it // If Filter array only contains 1 filter and its for basetype 'item', allow it
if (filter.length === 1 && filter.includes(BaseClasses.ITEM)) if (filter?.length === 1 && filter.includes(BaseClasses.ITEM))
{ {
return true; return true;
} }