Add defensive code to makeGetPostsInChannel to avoid panic (#24510)

This commit is contained in:
Ben Schumacher 2023-09-12 17:04:16 +02:00 committed by GitHub
parent 6109330beb
commit 7e0d9110ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}