Fix crash when invalid urls for image

This commit is contained in:
Benoit Marty 2019-07-05 17:00:57 +02:00
parent 302d23ba96
commit e5adf174a8
1 changed files with 6 additions and 0 deletions

View File

@ -28,6 +28,7 @@ import im.vector.riotx.core.di.ActiveSessionHolder
import im.vector.riotx.core.glide.GlideApp
import im.vector.riotx.core.utils.DimensionUtils.dpToPx
import kotlinx.android.parcel.Parcelize
import timber.log.Timber
import java.io.File
import javax.inject.Inject
@ -94,6 +95,11 @@ class ImageContentRenderer @Inject constructor(private val activeSessionHolder:
val fullSize = contentUrlResolver.resolveFullSize(data.url)
val thumbnail = contentUrlResolver.resolveThumbnail(data.url, width, height, ContentUrlResolver.ThumbnailMethod.SCALE)
if (fullSize.isNullOrBlank() || thumbnail.isNullOrBlank()) {
Timber.w("Invalid urls")
return
}
// TODO DECRYPT_FILE Decrypt file
imageView.showImage(
Uri.parse(thumbnail),