[Android] Prevent NPE

Geoffrey Métais git at videolan.org
Thu Apr 20 15:39:26 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Apr 20 10:58:31 2017 +0200| [579bdec9dca61e4973b120e36f469ae6fc81f56b] | committer: Geoffrey Métais

Prevent NPE

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

 vlc-android/src/org/videolan/vlc/media/MediaGroup.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/media/MediaGroup.java b/vlc-android/src/org/videolan/vlc/media/MediaGroup.java
index f4b8a78..147199b 100644
--- a/vlc-android/src/org/videolan/vlc/media/MediaGroup.java
+++ b/vlc-android/src/org/videolan/vlc/media/MediaGroup.java
@@ -90,14 +90,16 @@ public class MediaGroup extends MediaWrapper {
     public static List<MediaGroup> group(MediaWrapper[] mediaList) {
         ArrayList<MediaGroup> groups = new ArrayList<>();
         for (MediaWrapper media : mediaList)
-            insertInto(groups, media);
+            if (media != null)
+                insertInto(groups, media);
         return groups;
     }
 
     public static List<MediaGroup> group(List<MediaWrapper> mediaList) {
         ArrayList<MediaGroup> groups = new ArrayList<>();
         for (MediaWrapper media : mediaList)
-            insertInto(groups, media);
+            if (media != null)
+                insertInto(groups, media);
         return groups;
     }
 



More information about the Android mailing list