[Android] Fix NullPointerExceptions on tracks
Nicolas Pomepuy
git at videolan.org
Wed Oct 12 11:16:08 UTC 2022
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Oct 12 07:40:23 2022 +0200| [30586ffc8025c7a919352347e7cb19ec18580a7a] | committer: Nicolas Pomepuy
Fix NullPointerExceptions on tracks
> https://code.videolan.org/videolan/vlc-android/commit/30586ffc8025c7a919352347e7cb19ec18580a7a
---
application/vlc-android/vlc3/src/org/videolan/vlc/VersionDependant.kt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/application/vlc-android/vlc3/src/org/videolan/vlc/VersionDependant.kt b/application/vlc-android/vlc3/src/org/videolan/vlc/VersionDependant.kt
index c9d2dc757..873fccdae 100644
--- a/application/vlc-android/vlc3/src/org/videolan/vlc/VersionDependant.kt
+++ b/application/vlc-android/vlc3/src/org/videolan/vlc/VersionDependant.kt
@@ -51,7 +51,7 @@ fun MediaPlayer.getSelectedVideoTrack(): VlcTrack? = currentVideoTrack?.let { Vl
fun MediaPlayer.getSelectedAudioTrack(): VlcTrack? {
val currentTrackId = audioTrack
- audioTracks.forEach {
+ audioTracks?.forEach {
if (it.id == currentTrackId) return VlcTrackImpl(it)
}
return null
@@ -59,7 +59,7 @@ fun MediaPlayer.getSelectedAudioTrack(): VlcTrack? {
fun MediaPlayer.getSelectedSpuTrack(): VlcTrack? {
val currentTrackId = spuTrack
- spuTracks.forEach {
+ spuTracks?.forEach {
if (it.id == currentTrackId) return VlcTrackImpl(it)
}
return null
More information about the Android
mailing list