From 8b243a7f05804c809d9cf0f2c0b070c069c8cd53 Mon Sep 17 00:00:00 2001 From: Ivan Kupalov Date: Tue, 4 Aug 2020 21:57:12 +0200 Subject: [PATCH] Fix crash in ViewImageFragment, fix #1876 (#1877) It was not checked whether captionSheet is present. --- .../com/keylesspalace/tusky/fragment/ViewImageFragment.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/fragment/ViewImageFragment.kt b/app/src/main/java/com/keylesspalace/tusky/fragment/ViewImageFragment.kt index 1fae7c03..e61a24e5 100644 --- a/app/src/main/java/com/keylesspalace/tusky/fragment/ViewImageFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/fragment/ViewImageFragment.kt @@ -170,7 +170,7 @@ class ViewImageFragment : ViewMediaFragment() { } override fun onToolbarVisibilityChange(visible: Boolean) { - if (photoView == null || !userVisibleHint) { + if (photoView == null || !userVisibleHint || captionSheet == null) { return } isDescriptionVisible = showingDescription && visible @@ -178,7 +178,7 @@ class ViewImageFragment : ViewMediaFragment() { captionSheet.animate().alpha(alpha) .setListener(object : AnimatorListenerAdapter() { override fun onAnimationEnd(animation: Animator) { - captionSheet.visible(isDescriptionVisible) + captionSheet?.visible(isDescriptionVisible) animation.removeListener(this) } })