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 4554ee3eb..85c4212ef 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -255,7 +255,7 @@ class PhotoFragment : ViewPagerFragment() { .apply(options) .listener(object : RequestListener { override fun onLoadFailed(e: GlideException?, model: Any?, target: Target?, isFirstResource: Boolean): Boolean { - if (!useHalfResolution && e?.rootCauses?.first() is OutOfMemoryError) { + if (!useHalfResolution && e?.rootCauses?.firstOrNull() is OutOfMemoryError) { useHalfResolution = true Handler().post { loadBitmap(degrees)