mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 14:37:59 +01:00
add a null check at photo fragment
This commit is contained in:
parent
034f3b5c56
commit
12a0cb9f0a
1 changed files with 3 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue