Fix crash when unable to decode notification image preview.
This commit is contained in:
parent
bdbdcccaff
commit
4f803c695b
1 changed files with 14 additions and 8 deletions
|
@ -9,6 +9,7 @@ import org.thoughtcrime.securesms.dependencies.ApplicationDependencies
|
||||||
import org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader
|
import org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader
|
||||||
import org.thoughtcrime.securesms.mms.Slide
|
import org.thoughtcrime.securesms.mms.Slide
|
||||||
import org.thoughtcrime.securesms.providers.BlobProvider
|
import org.thoughtcrime.securesms.providers.BlobProvider
|
||||||
|
import org.thoughtcrime.securesms.util.BitmapDecodingException
|
||||||
import org.thoughtcrime.securesms.util.ImageCompressionUtil
|
import org.thoughtcrime.securesms.util.ImageCompressionUtil
|
||||||
import org.thoughtcrime.securesms.util.kb
|
import org.thoughtcrime.securesms.util.kb
|
||||||
import org.thoughtcrime.securesms.util.mb
|
import org.thoughtcrime.securesms.util.mb
|
||||||
|
@ -67,14 +68,19 @@ object NotificationThumbnails {
|
||||||
val uri = thumbnailSlide.uri
|
val uri = thumbnailSlide.uri
|
||||||
|
|
||||||
if (uri != null) {
|
if (uri != null) {
|
||||||
val result = ImageCompressionUtil.compressWithinConstraints(
|
val result: ImageCompressionUtil.Result? = try {
|
||||||
context,
|
ImageCompressionUtil.compressWithinConstraints(
|
||||||
thumbnailSlide.contentType,
|
context,
|
||||||
DecryptableStreamUriLoader.DecryptableUri(uri),
|
thumbnailSlide.contentType,
|
||||||
1024,
|
DecryptableStreamUriLoader.DecryptableUri(uri),
|
||||||
TARGET_SIZE,
|
1024,
|
||||||
60
|
TARGET_SIZE,
|
||||||
)
|
60
|
||||||
|
)
|
||||||
|
} catch (e: BitmapDecodingException) {
|
||||||
|
Log.i(TAG, "Unable to decode bitmap", e)
|
||||||
|
null
|
||||||
|
}
|
||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
val thumbnailUri = BlobProvider
|
val thumbnailUri = BlobProvider
|
||||||
|
|
Loading…
Add table
Reference in a new issue