Skip to content

Node.js based forum software built for the modern web

fix: don't crash if post is undefined

Barış Soner Uşaklıd477090804dd
diff --git a/src/topics/scheduled.js b/src/topics/scheduled.js
index 5b98bea84f..138c1330bf 100644
--- a/src/topics/scheduled.js
+++ b/src/topics/scheduled.js
@@ -154,7 +154,7 @@ async function updateUserLastposttimes(uids, topicsData) {
async function updateGroupPosts(uids, topicsData) {
const postsData = await posts.getPostsData(topicsData.map(t => t && t.mainPid));
await Promise.all(postsData.map(async (post, i) => {
- if (topicsData[i]) {
+ if (post && topicsData[i]) {
post.cid = topicsData[i].cid;
await groups.onNewPostMade(post);
}