diff options
author | George Rusu <george@tagg.id> | 2021-07-01 11:20:34 -0700 |
---|---|---|
committer | George Rusu <george@tagg.id> | 2021-07-01 11:20:34 -0700 |
commit | 34414dcf71e0c764e7c6102ef3711135e0d88a4c (patch) | |
tree | 885bff00c24ff3198839ac710a1a0eaf7159eb66 | |
parent | 7046c2673c54ecf2f418a85fbcfc2c4872858697 (diff) |
Check to make sure momentData is initialized and not empty before indexing
-rw-r--r-- | src/screens/profile/IndividualMoment.tsx | 2 |
1 files changed, 1 insertions, 1 deletions
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<IndividualMomentProps> = ({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); } }, |