From 660c19d20d007268d18bebd75c6f9328fdf48e16 Mon Sep 17 00:00:00 2001 From: Arthur Geron <71399856+arthurgeron-work@users.noreply.github.com> Date: Tue, 31 Oct 2023 13:02:09 -0300 Subject: [PATCH] fix: crash when opening null url (#2134) * fix: crash when opening null url * fix: only check url if type is video previous if would fail the validation for non-video attachments --------- Co-authored-by: Arthur Geron --- package/src/components/Attachment/Gallery.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package/src/components/Attachment/Gallery.tsx b/package/src/components/Attachment/Gallery.tsx index 06d86c307a..d7d1ed523e 100644 --- a/package/src/components/Attachment/Gallery.tsx +++ b/package/src/components/Attachment/Gallery.tsx @@ -308,6 +308,9 @@ const GalleryThumbnail = < }; const defaultOnPress = () => { + if ((thumbnail.type === 'video' && !thumbnail.thumb_url) || !thumbnail.url) { + return; + } if (thumbnail.type === 'video' && !isVideoPackageAvailable()) { // This condition is kinda unreachable, since we render videos as file attachment if the video // library is not installed. But doesn't hurt to have extra safeguard, in case of some customizations.