From 8290f432822f55f52c007cc65243a6d1456cd7c0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 9 Mar 2019 23:25:56 +0100 Subject: [PATCH] catch and show exceptions thrown at Editor filtering --- .../gallery/pro/activities/EditActivity.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt index bde21bca8..aa4d554a6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt @@ -583,7 +583,14 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener val thumbnailSize = resources.getDimension(R.dimen.bottom_filters_thumbnail_size).toInt() val bitmap = Glide.with(this) .asBitmap() - .load(uri) + .load(uri).listener(object : RequestListener { + override fun onLoadFailed(e: GlideException?, model: Any?, target: Target?, isFirstResource: Boolean): Boolean { + showErrorToast(e.toString()) + return false + } + + override fun onResourceReady(resource: Bitmap?, model: Any?, target: Target?, dataSource: DataSource?, isFirstResource: Boolean) = false + }) .submit(thumbnailSize, thumbnailSize) .get()