From 7e0d9110edf389e154a7069e3b4d96b784534294 Mon Sep 17 00:00:00 2001 From: Ben Schumacher Date: Tue, 12 Sep 2023 17:04:16 +0200 Subject: [PATCH] Add defensive code to makeGetPostsInChannel to avoid panic (#24510) --- .../packages/mattermost-redux/src/selectors/entities/posts.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/channels/src/packages/mattermost-redux/src/selectors/entities/posts.ts b/webapp/channels/src/packages/mattermost-redux/src/selectors/entities/posts.ts index dd875c93ad..35574e8e7a 100644 --- a/webapp/channels/src/packages/mattermost-redux/src/selectors/entities/posts.ts +++ b/webapp/channels/src/packages/mattermost-redux/src/selectors/entities/posts.ts @@ -296,7 +296,7 @@ export function makeGetPostsInChannel(): (state: GlobalState, channelId: Channel for (let i = 0; i < postIds.length; i++) { const post = allPosts[postIds[i]]; - if (shouldFilterJoinLeavePost(post, showJoinLeave, currentUser ? currentUser.username : '')) { + if (!post || shouldFilterJoinLeavePost(post, showJoinLeave, currentUser ? currentUser.username : '')) { continue; }