From 53572a3be6b6f3eeb17b02e5d1ce2745b9370e47 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 26 Sep 2019 11:41:22 +0200 Subject: [PATCH] Fix crash observed on the PlayStore --- .../room/detail/timeline/action/MessageMenuViewModel.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/action/MessageMenuViewModel.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/action/MessageMenuViewModel.kt index a39ad0feca..525bd6ff83 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/action/MessageMenuViewModel.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/action/MessageMenuViewModel.kt @@ -45,7 +45,7 @@ sealed class SimpleAction(@StringRes val titleRes: Int, @DrawableRes val iconRes data class Edit(val eventId: String) : SimpleAction(R.string.edit, R.drawable.ic_edit) data class Quote(val eventId: String) : SimpleAction(R.string.quote, R.drawable.ic_quote) data class Reply(val eventId: String) : SimpleAction(R.string.reply, R.drawable.ic_reply) - data class Share(val imageUrl: String?) : SimpleAction(R.string.share, R.drawable.ic_share) + data class Share(val imageUrl: String) : SimpleAction(R.string.share, R.drawable.ic_share) data class Resend(val eventId: String) : SimpleAction(R.string.global_retry, R.drawable.ic_refresh_cw) data class Remove(val eventId: String) : SimpleAction(R.string.remove, R.drawable.ic_trash) data class Delete(val eventId: String) : SimpleAction(R.string.delete, R.drawable.ic_delete) @@ -166,7 +166,9 @@ class MessageMenuViewModel @AssistedInject constructor(@Assisted initialState: M if (canShare(type)) { if (messageContent is MessageImageContent) { - add(SimpleAction.Share(session.contentUrlResolver().resolveFullSize(messageContent.url))) + session.contentUrlResolver().resolveFullSize(messageContent.url)?.let { url -> + add(SimpleAction.Share(url)) + } } //TODO }