From 0cd0b9d58064ff8cfbf1c73b098f319872cc1afa Mon Sep 17 00:00:00 2001 From: LucasGGamerM Date: Sat, 13 May 2023 21:18:00 -0300 Subject: [PATCH] fix: fix crashes when previewUrl is null on calckey --- .../android/ui/displayitems/MediaGridStatusDisplayItem.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/MediaGridStatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/MediaGridStatusDisplayItem.java index 83353ad8e..9e92dc8b6 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/MediaGridStatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/MediaGridStatusDisplayItem.java @@ -55,8 +55,8 @@ public class MediaGridStatusDisplayItem extends StatusDisplayItem{ for(Attachment att:attachments){ requests.add(new UrlImageLoaderRequest(switch(att.type){ case IMAGE -> att.url; - case VIDEO, GIFV -> att.previewUrl; - default -> throw new IllegalStateException("Unexpected value: "+att.type); + case VIDEO, GIFV -> att.previewUrl == null ? att.url : att.previewUrl; + default -> throw new IllegalStateException("Unexpected value: "+att.url); }, 1000, 1000)); } }