[Android] AudioUtil: fix NPE

Thomas Guillem git at videolan.org
Mon Jul 6 11:53:52 CEST 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Jul  6 11:53:34 2015 +0200| [fd504de3971b6793e93aa0f746d9ac48b7a516df] | committer: Thomas Guillem

AudioUtil: fix NPE

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

 vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java
index cf3e02d..b759732 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java
@@ -244,12 +244,12 @@ public class AudioUtil {
         if (index > 0) {
             final String name = f.getName().substring(0, index);
             final String ext  = f.getName().substring(index);
-            File[] files = folder.listFiles(new FilenameFilter() {
+            final File[] files = folder.listFiles(new FilenameFilter() {
                 public boolean accept(File dir, String filename) {
                     return filename.startsWith(name) && Arrays.asList(imageExt).contains(ext);
                 }
             });
-            if (files.length > 0)
+            if (files != null && files.length > 0)
                 return files[0].getAbsolutePath();
         }
 



More information about the Android mailing list