[Android] Crash fix when currentMediaPosition is -1
Nicolas Pomepuy
git at videolan.org
Thu Apr 9 09:16:10 CEST 2020
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Apr 1 07:44:55 2020 +0200| [51938c13b5c43b6539a3b5129095483846028583] | committer: Geoffrey Métais
Crash fix when currentMediaPosition is -1
> https://code.videolan.org/videolan/vlc-android/commit/51938c13b5c43b6539a3b5129095483846028583
---
application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt | 1 +
1 file changed, 1 insertion(+)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
index 39e5711e8..dbd3cf976 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
@@ -311,6 +311,7 @@ class AudioPlayer : Fragment(), PlaylistAdapter.IPlayer, TextWatcher, IAudioPlay
lifecycleScope.launchWhenStarted {
val text = withContext(Dispatchers.Default) {
val medias = playlistModel.medias ?: return at withContext ""
+ if (playlistModel.currentMediaPosition == -1) return at withContext ""
val elapsedTracksTime = medias.asSequence()
.take(playlistModel.currentMediaPosition)
.map { it.length }
More information about the Android
mailing list