try catching an exception at an editor filter applying

This commit is contained in:
tibbi 2019-06-27 10:10:29 +02:00
parent f066f4b84a
commit 4958402919
1 changed files with 18 additions and 11 deletions

View File

@ -583,7 +583,9 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
if (currPrimaryAction == PRIMARY_ACTION_FILTER && bottom_actions_filter_list.adapter == null) { if (currPrimaryAction == PRIMARY_ACTION_FILTER && bottom_actions_filter_list.adapter == null) {
Thread { Thread {
val thumbnailSize = resources.getDimension(R.dimen.bottom_filters_thumbnail_size).toInt() val thumbnailSize = resources.getDimension(R.dimen.bottom_filters_thumbnail_size).toInt()
val bitmap = Glide.with(this)
val bitmap = try {
Glide.with(this)
.asBitmap() .asBitmap()
.load(uri).listener(object : RequestListener<Bitmap> { .load(uri).listener(object : RequestListener<Bitmap> {
override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Bitmap>?, isFirstResource: Boolean): Boolean { override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Bitmap>?, isFirstResource: Boolean): Boolean {
@ -595,6 +597,11 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
}) })
.submit(thumbnailSize, thumbnailSize) .submit(thumbnailSize, thumbnailSize)
.get() .get()
} catch (e: GlideException) {
showErrorToast(e)
finish()
return@Thread
}
runOnUiThread { runOnUiThread {
val filterThumbnailsManager = FilterThumbnailsManager() val filterThumbnailsManager = FilterThumbnailsManager()