Skip to content

Commit

Permalink
fix: add a guard for populationYear
Browse files Browse the repository at this point in the history
Signed-off-by: Evan Prodromou <[email protected]>
  • Loading branch information
evanp committed Sep 12, 2024
1 parent 3e543ab commit e5a86dd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/src/app/api/v0/inventory/[inventory]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ export const GET = apiHandler(async (req, { params, session }) => {
});

const output: InventoryResponse = inventory.toJSON();
output.city.populationYear = populationYear!.year;
output.city.population = populationYear!.population!;
if (populationYear) {
output.city.populationYear = populationYear!.year;
output.city.population = populationYear!.population!;
}
let body: Buffer | null = null;
let headers: Record<string, string> | null = null;

Expand Down

0 comments on commit e5a86dd

Please sign in to comment.