Fix crash in ViewImageFragment, fix #1876 (#1877)

It was not checked whether captionSheet is present.
This commit is contained in:
Ivan Kupalov 2020-08-04 21:57:12 +02:00 committed by GitHub
parent 6c382aa5da
commit 8b243a7f05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -170,7 +170,7 @@ class ViewImageFragment : ViewMediaFragment() {
} }
override fun onToolbarVisibilityChange(visible: Boolean) { override fun onToolbarVisibilityChange(visible: Boolean) {
if (photoView == null || !userVisibleHint) { if (photoView == null || !userVisibleHint || captionSheet == null) {
return return
} }
isDescriptionVisible = showingDescription && visible isDescriptionVisible = showingDescription && visible
@ -178,7 +178,7 @@ class ViewImageFragment : ViewMediaFragment() {
captionSheet.animate().alpha(alpha) captionSheet.animate().alpha(alpha)
.setListener(object : AnimatorListenerAdapter() { .setListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator) { override fun onAnimationEnd(animation: Animator) {
captionSheet.visible(isDescriptionVisible) captionSheet?.visible(isDescriptionVisible)
animation.removeListener(this) animation.removeListener(this)
} }
}) })