From 18a5535205f825622beb8d71433d10f96780fb9b Mon Sep 17 00:00:00 2001 From: Chris Duarte Date: Tue, 28 Nov 2017 11:51:06 -0800 Subject: [PATCH] Defensive fix for post list scrollToIndex (#1223) --- app/components/post_list/post_list.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/post_list/post_list.js b/app/components/post_list/post_list.js index a84bf0bb9..6b103b10a 100644 --- a/app/components/post_list/post_list.js +++ b/app/components/post_list/post_list.js @@ -81,7 +81,7 @@ export default class PostList extends PureComponent { scrollList = () => { InteractionManager.runAfterInteractions(() => { - if (this.props.postIds.length && this.newMessagesIndex !== -1) { + if (this.props.postIds.length && this.newMessagesIndex !== -1 && this.newMessagesIndex <= this.props.postIds.length) { if (this.refs.list) { this.refs.list.scrollToIndex({ index: this.newMessagesIndex,