From 27fb0404caa36ca711a3f225d4cf6f5227ca3529 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 21 Aug 2018 10:18:57 +0200 Subject: [PATCH] adding a crashfix at loading fullscreen images --- .../simplemobiletools/gallery/fragments/PhotoFragment.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt index 1b294d73e..7210bec36 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -296,7 +296,9 @@ class PhotoFragment : ViewPagerFragment() { } override fun onError(e: Exception) { - tryLoadingWithGlide() + if (context != null) { + tryLoadingWithGlide() + } } }) } catch (ignored: Exception) { @@ -318,7 +320,7 @@ class PhotoFragment : ViewPagerFragment() { .diskCacheStrategy(DiskCacheStrategy.RESOURCE) .override(targetWidth, targetHeight) - Glide.with(this) + Glide.with(context!!) .asBitmap() .load(getPathToLoad(medium)) .apply(options)