From 9b337d8c0fce9c9aa68e44d76569c5abc6c0202e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 27 Nov 2020 11:48:20 +0100 Subject: [PATCH] Fix 500 on unknown thread --- server/controllers/api/videos/comment.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/controllers/api/videos/comment.ts b/server/controllers/api/videos/comment.ts index ccd76c093..020d0b104 100644 --- a/server/controllers/api/videos/comment.ts +++ b/server/controllers/api/videos/comment.ts @@ -160,6 +160,10 @@ async function listVideoThreadComments (req: express.Request, res: express.Respo } } + if (resultList.data.length === 0) { + return res.sendStatus(404) + } + return res.json(buildFormattedCommentTree(resultList)) }