[Android] Avoid possible null pointer exception

Jean-Baptiste Kempf git at videolan.org
Wed Aug 8 14:36:46 CEST 2012


android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Wed Aug  8 14:32:29 2012 +0200| [bae8a75463594411bdee3ac57ef1642d6c1d0178] | committer: Jean-Baptiste Kempf

Avoid possible null pointer exception

> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=bae8a75463594411bdee3ac57ef1642d6c1d0178
---

 vlc-android/src/org/videolan/vlc/MediaLibrary.java |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/MediaLibrary.java b/vlc-android/src/org/videolan/vlc/MediaLibrary.java
index 680133b..4e4ae99 100644
--- a/vlc-android/src/org/videolan/vlc/MediaLibrary.java
+++ b/vlc-android/src/org/videolan/vlc/MediaLibrary.java
@@ -81,7 +81,7 @@ public class MediaLibrary {
         ArrayList<Media> videoItems = new ArrayList<Media>();
         for (int i = 0; i < mItemList.size(); i++) {
             Media item = mItemList.get(i);
-            if (item.getType() == Media.TYPE_VIDEO) {
+            if (item != null && item.getType() == Media.TYPE_VIDEO) {
                 videoItems.add(item);
             }
         }



More information about the Android mailing list