Fix: check for empty object when looking at key length

This commit is contained in:
Dev 2023-03-21 15:31:42 +00:00
parent 16e1293d55
commit 5e739c2a90
2 changed files with 2 additions and 2 deletions

View File

@ -318,7 +318,7 @@ export class BotGenerator
*/ */
protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[] protected getSkillsWithRandomisedProgressValue(skills: IBaseSkill[]): IBaseSkill[]
{ {
if (Object.keys(skills).length === 0) if (Object.keys(skills ?? []).length === 0)
{ {
return; return;
} }

View File

@ -258,7 +258,7 @@ export class BotInventoryGenerator
protected getFilteredDynamicModsForItem(itemTpl: string, equipmentBlacklist: EquipmentFilterDetails[]): Record<string, string[]> protected getFilteredDynamicModsForItem(itemTpl: string, equipmentBlacklist: EquipmentFilterDetails[]): Record<string, string[]>
{ {
const modPool = this.botEquipmentModPoolService.getModsForGearSlot(itemTpl); const modPool = this.botEquipmentModPoolService.getModsForGearSlot(itemTpl);
for (const modSlot of Object.keys(modPool)) for (const modSlot of Object.keys(modPool ?? []))
{ {
const blacklistedMods = equipmentBlacklist[0].equipment[modSlot] || []; const blacklistedMods = equipmentBlacklist[0].equipment[modSlot] || [];
const filteredMods = modPool[modSlot].filter(x => !blacklistedMods.includes(x)); const filteredMods = modPool[modSlot].filter(x => !blacklistedMods.includes(x));