From b5a402c1e11ffa30692eb64cae9285d03b85af37 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 26 Feb 2020 17:45:39 +0100 Subject: [PATCH] Fix crash when editing image --- .../attachments/preview/AttachmentsPreviewFragment.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/riotx/features/attachments/preview/AttachmentsPreviewFragment.kt b/vector/src/main/java/im/vector/riotx/features/attachments/preview/AttachmentsPreviewFragment.kt index e78cc09083..df4f8a9b59 100644 --- a/vector/src/main/java/im/vector/riotx/features/attachments/preview/AttachmentsPreviewFragment.kt +++ b/vector/src/main/java/im/vector/riotx/features/attachments/preview/AttachmentsPreviewFragment.kt @@ -201,7 +201,9 @@ class AttachmentsPreviewFragment @Inject constructor( private fun doHandleEditAction() = withState(viewModel) { val currentAttachment = it.attachments.getOrNull(it.currentAttachmentIndex) ?: return@withState val destinationFile = File(requireContext().cacheDir, "${currentAttachment.name}_edited_image_${System.currentTimeMillis()}") - UCrop.of(currentAttachment.queryUri.toUri(), destinationFile.toUri()) + // Note: using currentAttachment.queryUri.toUri() make the app crash when sharing from Google Photos + val uri = File(currentAttachment.path).toUri() + UCrop.of(uri, destinationFile.toUri()) .withOptions( UCrop.Options() .apply {