From ca4eebc3b92996ed053734f5ce14a390910dda5c Mon Sep 17 00:00:00 2001 From: kchenturtles <94144671+kchenturtles@users.noreply.github.com> Date: Sat, 23 Dec 2023 06:19:13 -0500 Subject: [PATCH] catch null --- components/postPreview.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/postPreview.tsx b/components/postPreview.tsx index b349aa5..4d40457 100644 --- a/components/postPreview.tsx +++ b/components/postPreview.tsx @@ -12,7 +12,9 @@ type Items = { export default function PostPreview({ post }: { post: Items }) { const router = useRouter(); - router.push(`/blog/${post.slug}`); + if(post.slug != null && post.slug != undefined) { + router.push(`/blog/${post.slug}`); + } return (