aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Rusu <george@tagg.id>2021-07-01 11:20:34 -0700
committerGeorge Rusu <george@tagg.id>2021-07-01 11:20:34 -0700
commit34414dcf71e0c764e7c6102ef3711135e0d88a4c (patch)
tree885bff00c24ff3198839ac710a1a0eaf7159eb66
parent7046c2673c54ecf2f418a85fbcfc2c4872858697 (diff)
Check to make sure momentData is initialized and not empty before indexing
-rw-r--r--src/screens/profile/IndividualMoment.tsx2
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);
}
},