Skip to content

Commit

Permalink
added undefined case for slot
Browse files Browse the repository at this point in the history
  • Loading branch information
MineFact committed Mar 6, 2024
1 parent 52fb001 commit 9c4ee6e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/routes/teams/POST_WarpGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,16 @@ export async function initRoutes(app: Router, joi: any, network: Network) {
const name = req.body.name; // The name of the warp.
const description = req.body.description; // The description of the warp.
let slot = req.body.slot; // The slot of the warp.
const material = req.body.material; // The material of the warp.
let material = req.body.material; // The material of the warp.

// If the slot is not provided, set it to -1
if(slot < 0 || slot >= 27)
// If the slot is not provided, or is invalid, set it to -1
if(slot == undefined || slot < 0 || slot >= 27)
slot = -1;

// If the material is not specified, set it to null
if(material == undefined)
material = null;

// Create a new warp
const promise = buildTeam.createWarpGroup(id, name, description, slot, material);

Expand Down

0 comments on commit 9c4ee6e

Please sign in to comment.