From e94c45143979e3bd261a5cb0ceac7f3fd0fcec86 Mon Sep 17 00:00:00 2001 From: Yasamato Date: Sat, 30 Dec 2023 13:45:38 +0100 Subject: [PATCH] Add typecheck against null (#88) --- lib/db/views.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/db/views.ts b/lib/db/views.ts index a0cfbabb..8ec28614 100644 --- a/lib/db/views.ts +++ b/lib/db/views.ts @@ -51,8 +51,9 @@ export async function getLastViews(type: Types, n: number) { await Promise.all( sorted.map(async (s) => { const data = await findOneTyped(type, s.contentId) - - data.views = s.count + if (data !== null) { + data.views = s.count + } return data }) )