From 34414dcf71e0c764e7c6102ef3711135e0d88a4c Mon Sep 17 00:00:00 2001 From: George Rusu Date: Thu, 1 Jul 2021 11:20:34 -0700 Subject: Check to make sure momentData is initialized and not empty before indexing --- src/screens/profile/IndividualMoment.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/screens/profile/IndividualMoment.tsx b/src/screens/profile/IndividualMoment.tsx index a322b1e9..0fd15b2c 100644 --- a/src/screens/profile/IndividualMoment.tsx +++ b/src/screens/profile/IndividualMoment.tsx @@ -49,7 +49,7 @@ const IndividualMoment: React.FC = ({route}) => { const viewabilityConfigCallback = useRef( (info: {viewableItems: ViewToken[]; changed: ViewToken[]}) => { const index = info.viewableItems[0].index; - if (index !== null) { + if (index !== null && momentData.length > 0) { setCurrentVisibleMomentId(momentData[index].moment_id); } }, -- cgit v1.2.3-70-g09d2