From 7939a60698e9cc996939e23847e7b287965759ed Mon Sep 17 00:00:00 2001 From: Bnyro Date: Thu, 23 Feb 2023 19:24:26 +0100 Subject: [PATCH] Fix autoplay countdown crash --- .../github/libretube/ui/fragments/PlayerFragment.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt index db1248c17..fee7e57be 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt @@ -1023,11 +1023,16 @@ class PlayerFragment : Fragment(R.layout.fragment_player), OnlinePlayerOptions { binding.player.useController = false binding.player.hideController() binding.autoplayCountdown.setHideSelfListener { - binding.autoplayCountdown.visibility = View.GONE - binding.player.useController = true + // could fail if the video already got closed before + runCatching { + binding.autoplayCountdown.visibility = View.GONE + binding.player.useController = true + } } binding.autoplayCountdown.startCountdown { - playNextVideo() + runCatching { + playNextVideo() + } } }