Skip to content

Commit

Permalink
Add typecheck against null (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yasamato authored Dec 30, 2023
1 parent f54fc29 commit e94c451
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/db/views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
)
Expand Down

0 comments on commit e94c451

Please sign in to comment.