From ad87efa7e25ba36a1e466a7d36902ace5c8c4014 Mon Sep 17 00:00:00 2001 From: Grishka Date: Sun, 15 Jan 2023 11:40:06 +0300 Subject: [PATCH] Fix #484 --- .../org/joinmastodon/android/fragments/ComposeFragment.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java index def85ee47..3ff757f08 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java @@ -720,7 +720,7 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr DraftMediaAttachment da=new DraftMediaAttachment(); da.serverAttachment=att; da.description=att.description; - da.uri=Uri.parse(att.previewUrl); + da.uri=att.previewUrl!=null ? Uri.parse(att.previewUrl) : null; da.state=AttachmentUploadState.DONE; attachmentsView.addView(createMediaAttachmentView(da)); attachments.add(da); @@ -1307,7 +1307,8 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr View thumb=getActivity().getLayoutInflater().inflate(R.layout.compose_media_thumb, attachmentsView, false); ImageView img=thumb.findViewById(R.id.thumb); if(draft.serverAttachment!=null){ - ViewImageLoader.load(img, draft.serverAttachment.blurhashPlaceholder, new UrlImageLoaderRequest(draft.serverAttachment.previewUrl, V.dp(250), V.dp(250))); + if(draft.serverAttachment.previewUrl!=null) + ViewImageLoader.load(img, draft.serverAttachment.blurhashPlaceholder, new UrlImageLoaderRequest(draft.serverAttachment.previewUrl, V.dp(250), V.dp(250))); }else{ if(draft.mimeType.startsWith("image/")){ ViewImageLoader.load(img, null, new UrlImageLoaderRequest(draft.uri, V.dp(250), V.dp(250)));