0
0
mirror of https://github.com/sp-tarkov/server.git synced 2025-02-13 09:50:43 -05:00

Prevented NRE being thrown when no weapon found inside getSealedContainerWeaponModRewards()

This commit is contained in:
Dev 2024-06-12 12:41:09 +01:00
parent 16f170f28e
commit 292dadc55e

View File

@ -545,13 +545,13 @@ export class LootGenerator
} }
// Get items that fulfil reward type criteria from items that fit on gun // Get items that fulfil reward type criteria from items that fit on gun
const relatedItems = linkedItemsToWeapon.filter( const relatedItems = linkedItemsToWeapon?.filter(
(x) => x._parent === rewardTypeId && !this.itemFilterService.isItemBlacklisted(x._id), (item) => item._parent === rewardTypeId && !this.itemFilterService.isItemBlacklisted(item._id),
); );
if (!relatedItems || relatedItems.length === 0) if (!relatedItems || relatedItems.length === 0)
{ {
this.logger.debug( this.logger.debug(
`No items found to fulfil reward type ${rewardTypeId} for weapon: ${chosenWeaponPreset._name}, skipping type`, `No items found to fulfil reward type: ${rewardTypeId} for weapon: ${chosenWeaponPreset._name}, skipping type`,
); );
continue; continue;
} }