diff --git a/src/controllers/custom/importController.ts b/src/controllers/custom/importController.ts index b6b5571b..b73089f1 100644 --- a/src/controllers/custom/importController.ts +++ b/src/controllers/custom/importController.ts @@ -21,7 +21,11 @@ export const importController: RequestHandler = async (req, res) => { await loadout.save(); } - if ("Ship" in request.inventory || "Apartment" in request.inventory || "TailorShop" in request.inventory) { + if ( + request.inventory.Ship?.Rooms || // very old accounts may have Ship with { Features: [ ... ] } + "Apartment" in request.inventory || + "TailorShop" in request.inventory + ) { const personalRooms = await getPersonalRooms(accountId); importPersonalRooms(personalRooms, request.inventory); await personalRooms.save(); diff --git a/src/services/importService.ts b/src/services/importService.ts index 0801500c..31d4c583 100644 --- a/src/services/importService.ts +++ b/src/services/importService.ts @@ -570,7 +570,7 @@ const convertTailorShop = (client: ITailorShop): ITailorShopDatabase => { }; export const importPersonalRooms = (db: IPersonalRoomsDatabase, client: Partial): void => { - if (client.Ship !== undefined) db.Ship = convertShip(client.Ship); + if (client.Ship?.Rooms) db.Ship = convertShip(client.Ship); if (client.Apartment !== undefined) db.Apartment = convertApartment(client.Apartment); if (client.TailorShop !== undefined) db.TailorShop = convertTailorShop(client.TailorShop); };