[Android] Fix NullPointerException

Nicolas Pomepuy git at videolan.org
Mon Sep 23 18:10:24 CEST 2019


vlc-android | branch: 3.2.x | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Wed Sep 11 08:54:03 2019 +0200| [d1db74422ba906cc504442252488cf0f4305b083] | committer: Geoffrey Métais

Fix NullPointerException

(cherry picked from commit 128e763a71d2ff116d0a395da1d109919347f09b)

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

 medialibrary/src/org/videolan/medialibrary/Medialibrary.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/medialibrary/src/org/videolan/medialibrary/Medialibrary.java b/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
index 5eb03e201..3436f27df 100644
--- a/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
+++ b/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
@@ -71,8 +71,10 @@ public class Medialibrary extends AbstractMedialibrary {
                 public void run() {
 
                     String[] children = oldDir.list();
-                    for (String child : children) {
-                        new File(oldDir, child).delete();
+                    if (children != null) {
+                        for (String child : children) {
+                            new File(oldDir, child).delete();
+                        }
                     }
                     oldDir.delete();
                 }



More information about the Android mailing list