From f6896a441f84ae387a7a0600246ee58c031f0cc1 Mon Sep 17 00:00:00 2001 From: Jon Carifio Date: Tue, 15 Aug 2023 14:55:59 -0400 Subject: [PATCH] Add a missing undefined guard --- src/server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server.ts b/src/server.ts index f862e27..df7303d 100644 --- a/src/server.ts +++ b/src/server.ts @@ -545,7 +545,7 @@ app.post("/question/:tag", async (req, res) => { app.get("/questions/:storyName", async (req, res) => { const storyName = req.params.storyName; const newestOnlyString = req.query.newest_only as string; - const newestOnly = newestOnlyString.toLowerCase() !== "false"; + const newestOnly = newestOnlyString?.toLowerCase() !== "false"; const questions = await getQuestionsForStory(storyName, newestOnly); res.json({ questions