Skip to content

Commit

Permalink
Add defensive code to makeGetPostsInChannel to avoid panic (mattermos…
Browse files Browse the repository at this point in the history
  • Loading branch information
hanzei authored Sep 12, 2023
1 parent 6109330 commit 7e0d911
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 7e0d911

Please sign in to comment.