add a null check at photo fragment

This commit is contained in:
tibbi 2017-06-19 07:45:36 +02:00
parent 034f3b5c56
commit 12a0cb9f0a

View file

@ -237,6 +237,9 @@ class PhotoFragment : ViewPagerFragment() {
val height = bitmapOptions.outHeight val height = bitmapOptions.outHeight
val bitmapAspectRatio = height / (width).toFloat() val bitmapAspectRatio = height / (width).toFloat()
if (context == null)
return 2f
return if (context.portrait && bitmapAspectRatio <= 1f) { return if (context.portrait && bitmapAspectRatio <= 1f) {
ViewPagerActivity.screenHeight / height.toFloat() ViewPagerActivity.screenHeight / height.toFloat()
} else if (!context.portrait && bitmapAspectRatio >= 1f) { } else if (!context.portrait && bitmapAspectRatio >= 1f) {