summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-06-23 16:21:52 -0400
committerHarrison Healey <harrisonmhealey@gmail.com>2017-06-23 16:21:52 -0400
commit458d7d0021b957a480c4c3c947c6a745da9711b4 (patch)
tree477a94471fa1117644eafd67cc935289f41e5da8 /webapp
parenta077cae27985583aa4398ae29ffb25705dc352f9 (diff)
downloadchat-458d7d0021b957a480c4c3c947c6a745da9711b4.tar.gz
chat-458d7d0021b957a480c4c3c947c6a745da9711b4.tar.bz2
chat-458d7d0021b957a480c4c3c947c6a745da9711b4.zip
Fix JS error from null posts (#6722)
Diffstat (limited to 'webapp')
-rw-r--r--webapp/components/post_view/post/index.js7
-rw-r--r--webapp/components/post_view/post_list.jsx4
2 files changed, 8 insertions, 3 deletions
diff --git a/webapp/components/post_view/post/index.js b/webapp/components/post_view/post/index.js
index 1e195f920..2e7125f34 100644
--- a/webapp/components/post_view/post/index.js
+++ b/webapp/components/post_view/post/index.js
@@ -12,12 +12,13 @@ import {Preferences} from 'utils/constants.jsx';
import Post from './post.jsx';
function mapStateToProps(state, ownProps) {
- const detailedPost = ownProps.post;
+ const detailedPost = ownProps.post || {};
+
return {
post: getPost(state, detailedPost.id),
lastPostCount: ownProps.lastPostCount,
- user: getUser(state, ownProps.post.user_id),
- status: getStatusForUserId(state, ownProps.post.user_id),
+ user: getUser(state, detailedPost.user_id),
+ status: getStatusForUserId(state, detailedPost.user_id),
currentUser: getCurrentUser(state),
isFirstReply: Boolean(detailedPost.isFirstReply && detailedPost.commentedOnPost),
highlight: detailedPost.highlight,
diff --git a/webapp/components/post_view/post_list.jsx b/webapp/components/post_view/post_list.jsx
index 3ae768b5c..8d790832e 100644
--- a/webapp/components/post_view/post_list.jsx
+++ b/webapp/components/post_view/post_list.jsx
@@ -370,6 +370,10 @@ export default class PostList extends React.PureComponent {
for (let i = posts.length - 1; i >= 0; i--) {
const post = posts[i];
+ if (post == null) {
+ continue;
+ }
+
const postCtl = (
<Post
ref={post.id}