From e824c659e155978d1b89c8a2917fa45bd125b843 Mon Sep 17 00:00:00 2001 From: AbdallahMehiz Date: Sat, 24 Aug 2024 03:31:19 +0100 Subject: [PATCH] fix: crash on videos without chapters also don't obfuscate when optimizing with r8 --- app/proguard-rules.pro | 1 + app/src/main/java/live/mehiz/mpvkt/ui/player/PlayerViewModel.kt | 1 + 2 files changed, 2 insertions(+) diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 4242213..5b87d41 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -19,5 +19,6 @@ # If you keep the line number information, uncomment this to # hide the original source file name. #-renamesourcefileattribute SourceFile +-dontobfuscate -keep,allowoptimization class is.xyz.mpv.** { public protected *; } -keep,allowoptimization class com.arthenica.** { public protected *; } \ No newline at end of file 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 e4f489f..1ebca41 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,6 +204,7 @@ class PlayerViewModel( } fun updateChapter(index: Long) { + if (chapters.isEmpty()) return _currentChapter.update { chapters[index.toInt()] } }