From 290ff6f993e41254d651bdacfd57254fcbaeb582 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 16 Dec 2019 20:54:34 +0100 Subject: [PATCH] adding extra null checks at extended details fetching --- .../simplemobiletools/gallery/pro/fragments/PhotoFragment.kt | 2 +- .../simplemobiletools/gallery/pro/fragments/VideoFragment.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt index 456680c0b..212f0da68 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt @@ -792,7 +792,7 @@ class PhotoFragment : ViewPagerFragment() { } private fun getExtendedDetailsY(height: Int): Float { - val smallMargin = resources.getDimension(R.dimen.small_margin) + val smallMargin = context?.resources?.getDimension(R.dimen.small_margin) ?: return 0f val fullscreenOffset = smallMargin + if (mIsFullscreen) 0 else context!!.navigationBarHeight val actionsHeight = if (context!!.config.bottomActions && !mIsFullscreen) resources.getDimension(R.dimen.bottom_actions_height) else 0f return context!!.realScreenSize.y - height - actionsHeight - fullscreenOffset diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt index d120839ae..96879d3c1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt @@ -471,7 +471,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S } private fun getExtendedDetailsY(height: Int): Float { - val smallMargin = resources.getDimension(R.dimen.small_margin) + val smallMargin = context?.resources?.getDimension(R.dimen.small_margin) ?: return 0f val fullscreenOffset = smallMargin + if (mIsFullscreen) 0 else context!!.navigationBarHeight var actionsHeight = 0f if (!mIsFullscreen) {