From 12a0cb9f0ad904d75571b9ca660fde5b2a8ea324 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 19 Jun 2017 07:45:36 +0200 Subject: [PATCH] add a null check at photo fragment --- .../com/simplemobiletools/gallery/fragments/PhotoFragment.kt | 3 +++ 1 file changed, 3 insertions(+) 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 e3122eef4..7f82ae47f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -237,6 +237,9 @@ class PhotoFragment : ViewPagerFragment() { val height = bitmapOptions.outHeight val bitmapAspectRatio = height / (width).toFloat() + if (context == null) + return 2f + return if (context.portrait && bitmapAspectRatio <= 1f) { ViewPagerActivity.screenHeight / height.toFloat() } else if (!context.portrait && bitmapAspectRatio >= 1f) {