fix: motorcycle in backroom is broken #736
@ -16,8 +16,8 @@ export const setBootLocationController: RequestHandler = async (req, res) => {
|
|||||||
const inventory = await getInventory(accountId);
|
const inventory = await getInventory(accountId);
|
||||||
if (inventory.Motorcycles.length == 0) {
|
if (inventory.Motorcycles.length == 0) {
|
||||||
inventory.Motorcycles.push({ ItemType: "/Lotus/Types/Vehicles/Motorcycle/MotorcyclePowerSuit" });
|
inventory.Motorcycles.push({ ItemType: "/Lotus/Types/Vehicles/Motorcycle/MotorcyclePowerSuit" });
|
||||||
|
await inventory.save();
|
||||||
}
|
}
|
||||||
await inventory.save();
|
|
||||||
}
|
}
|
||||||
|
|||||||
|
|
||||||
res.end();
|
res.end();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user
🛠️ Refactor suggestion
Add error handling and avoid potential race conditions.
While the code ensures that a motorcycle is added when none exists, there are scenarios to consider:
getInventory()
might fail due to network or database issues; adding error handling (try/catch) secures against possible exceptions.Would you like help drafting concurrent-safe logic or adding a robust error-handling block to ensure data integrity?