[Android] Prevent NPE

Geoffrey Métais git at videolan.org
Thu Feb 19 11:09:06 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Feb 19 10:36:30 2015 +0100| [88d15150a0721ea27031a5827506dea843858f34] | committer: Geoffrey Métais

Prevent NPE

CID #1226305

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

 vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java |    6 ++++--
 1 file changed, 4 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 dd551e4..94c4520 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioUtil.java
@@ -144,8 +144,10 @@ public class AudioUtil {
     private static void deleteContent(File dir, boolean deleteDir) {
         if (dir.isDirectory()) {
             File[] files = dir.listFiles();
-            for (File file : files) {
-                deleteContent(file, true);
+            if (files != null && files.length > 0) {
+                for (File file : files) {
+                    deleteContent(file, true);
+                }
             }
         }
         if (deleteDir)



More information about the Android mailing list