[Android] Nullity check

Geoffrey Métais git at videolan.org
Wed Mar 9 15:21:01 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Mar  9 15:13:47 2016 +0100| [38171fc64d0c6e81e1ff7993527c0f793401b56a] | committer: Geoffrey Métais

Nullity check

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

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

diff --git a/vlc-android/src/org/videolan/vlc/media/MediaUtils.java b/vlc-android/src/org/videolan/vlc/media/MediaUtils.java
index fc015aa..cb51899 100644
--- a/vlc-android/src/org/videolan/vlc/media/MediaUtils.java
+++ b/vlc-android/src/org/videolan/vlc/media/MediaUtils.java
@@ -70,6 +70,8 @@ public class MediaUtils {
     }
 
     public static void openList(final Context context, final List<MediaWrapper> list, final int position){
+        if (list == null || list.isEmpty())
+            return;
         new DialogCallback(context, new DialogCallback.Runnable() {
             @Override
             public void run(PlaybackService service) {
@@ -79,6 +81,8 @@ public class MediaUtils {
     }
 
     public static void openUri(final Context context, final Uri uri){
+        if (uri == null)
+            return;
         new DialogCallback(context, new DialogCallback.Runnable() {
             @Override
             public void run(PlaybackService service) {
@@ -88,6 +92,8 @@ public class MediaUtils {
     }
 
     public static void openStream(final Context context, final String uri){
+        if (uri == null)
+            return;
         new DialogCallback(context, new DialogCallback.Runnable() {
             @Override
             public void run(PlaybackService service) {



More information about the Android mailing list