Unverified Commit ca864422 authored by Leonardo Aramaki's avatar Leonardo Aramaki Committed by GitHub

Merge pull request #1005 from RocketChat/fix/view-model-mapper-crash

[FIX] Crash on ViewModelMapper
parents 8ea28419 27fb131c
......@@ -7,8 +7,8 @@ data class MessageAttachmentViewModel(
override val message: Message,
override val rawData: Message,
override val messageId: String,
var senderName: String,
val time: CharSequence,
var senderName: String?,
val time: CharSequence?,
val content: CharSequence,
val isPinned: Boolean,
override var reactions: List<ReactionViewModel>,
......
......@@ -103,8 +103,8 @@ class ViewModelMapper @Inject constructor(private val context: Context,
}
private suspend fun mapMessageAttachment(message: Message, attachment: MessageAttachment): MessageAttachmentViewModel {
val attachmentAuthor = attachment.author!!
val time = getTime(attachment.timestamp!!)
val attachmentAuthor = attachment.author
val time = attachment.timestamp?.let { getTime(it) }
val attachmentText = when (attachment.attachments.orEmpty().firstOrNull()) {
is ImageAttachment -> context.getString(R.string.msg_preview_photo)
is VideoAttachment -> context.getString(R.string.msg_preview_video)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment