From 4a3e36a766dd45f51d653978520a1106ac94bb37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Sun, 14 Aug 2022 20:18:18 -0400 Subject: [PATCH] fix: don't crash if post is undefined --- src/posts/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/posts/index.js b/src/posts/index.js index 7b6d3ac787..196ebfc65a 100644 --- a/src/posts/index.js +++ b/src/posts/index.js @@ -93,7 +93,7 @@ Posts.getPostIndices = async function (posts, uid) { }; Posts.modifyPostByPrivilege = function (post, privileges) { - if (post.deleted && !(post.selfPost || privileges['posts:view_deleted'])) { + if (post && post.deleted && !(post.selfPost || privileges['posts:view_deleted'])) { post.content = '[[topic:post_is_deleted]]'; if (post.user) { post.user.signature = '';