[Android] Vlc4MigrationHelper: fix getTracks == null crash

Duncan McNamara git at videolan.org
Fri Jul 7 13:38:35 UTC 2023


vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Thu Jun 29 13:56:01 2023 +0200| [daedac258946fb728f2d980958c86ca5048070ba] | committer: Nicolas Pomepuy

Vlc4MigrationHelper: fix getTracks == null crash

> https://code.videolan.org/videolan/vlc-android/commit/daedac258946fb728f2d980958c86ca5048070ba
---

 medialibrary/vlc4/src/org/videolan/vlc/VlcMigrationHelper.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/medialibrary/vlc4/src/org/videolan/vlc/VlcMigrationHelper.java b/medialibrary/vlc4/src/org/videolan/vlc/VlcMigrationHelper.java
index 27b63c489c..861c67b43a 100644
--- a/medialibrary/vlc4/src/org/videolan/vlc/VlcMigrationHelper.java
+++ b/medialibrary/vlc4/src/org/videolan/vlc/VlcMigrationHelper.java
@@ -32,6 +32,10 @@ import java.util.Arrays;
 
 public class VlcMigrationHelper {
     public static List<IMedia.Track> getMediaTracks(IMedia media) {
-        return Arrays.asList(media.getTracks());
+        IMedia.Track[] tracks = media.getTracks();
+        if (tracks == null) {
+            return new ArrayList<IMedia.Track>();
+        }
+        return Arrays.asList(tracks);
     }
 }



More information about the Android mailing list