From 0642c00fbc22e5fc7d4e749e0d69f94c4b41999e Mon Sep 17 00:00:00 2001 From: AbdallahMehiz Date: Mon, 26 Aug 2024 10:50:23 +0100 Subject: [PATCH] fix: crash when empty chapters --- app/src/main/java/live/mehiz/mpvkt/ui/player/PlayerViewModel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/live/mehiz/mpvkt/ui/player/PlayerViewModel.kt b/app/src/main/java/live/mehiz/mpvkt/ui/player/PlayerViewModel.kt index 4b7c080..6ceff0f 100644 --- a/app/src/main/java/live/mehiz/mpvkt/ui/player/PlayerViewModel.kt +++ b/app/src/main/java/live/mehiz/mpvkt/ui/player/PlayerViewModel.kt @@ -204,7 +204,7 @@ class PlayerViewModel( } fun updateChapter(index: Long) { - if (chapters.isEmpty()) return + if (chapters.isEmpty() && index == -1L) return _currentChapter.update { chapters[index.toInt()] } }