diff --git a/src/services/importService.ts b/src/services/importService.ts index 87ba9231..3ec3c266 100644 --- a/src/services/importService.ts +++ b/src/services/importService.ts @@ -54,8 +54,14 @@ const replaceArray = (arr: T[], replacement: T[]): void => { }); }; -export const importInventory = (db: TInventoryDatabaseDocument, client: IInventoryClient): void => { - replaceArray(db.Suits, client.Suits.map(convertEquipment)); - replaceArray(db.WeaponSkins, client.WeaponSkins.map(convertWeaponSkin)); - replaceArray(db.Upgrades, client.Upgrades.map(convertUpgrade)); +export const importInventory = (db: TInventoryDatabaseDocument, client: Partial): void => { + if (client.Suits) { + replaceArray(db.Suits, client.Suits.map(convertEquipment)); + } + if (client.WeaponSkins) { + replaceArray(db.WeaponSkins, client.WeaponSkins.map(convertWeaponSkin)); + } + if (client.Upgrades) { + replaceArray(db.Upgrades, client.Upgrades.map(convertUpgrade)); + } };