[Android] FileUtils: prevent NullPointerException

Geoffrey Métais git at videolan.org
Mon May 27 16:27:26 CEST 2019


vlc-android | branch: 3.1.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon May 27 16:08:46 2019 +0200| [3fe42f5ffcc7777044032f6a15e8206dba04c28e] | committer: Geoffrey Métais

FileUtils: prevent NullPointerException

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

 vlc-android/src/org/videolan/vlc/util/FileUtils.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/util/FileUtils.java b/vlc-android/src/org/videolan/vlc/util/FileUtils.java
index 91ea55516..8711e5e46 100644
--- a/vlc-android/src/org/videolan/vlc/util/FileUtils.java
+++ b/vlc-android/src/org/videolan/vlc/util/FileUtils.java
@@ -35,6 +35,9 @@ import android.provider.MediaStore;
 import android.text.TextUtils;
 import android.util.Log;
 
+import androidx.annotation.WorkerThread;
+import androidx.documentfile.provider.DocumentFile;
+
 import org.videolan.libvlc.util.AndroidUtil;
 import org.videolan.medialibrary.media.MediaWrapper;
 import org.videolan.vlc.BuildConfig;
@@ -61,9 +64,6 @@ import java.util.List;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 
-import androidx.annotation.WorkerThread;
-import androidx.documentfile.provider.DocumentFile;
-
 public class FileUtils {
 
     public final static String TAG = "VLC/FileUtils";
@@ -438,7 +438,7 @@ public class FileUtils {
 //                        }
 //                        returnCursor.close();
 //                    }
-                } catch (FileNotFoundException|IllegalArgumentException e) {
+                } catch (FileNotFoundException|IllegalArgumentException|NullPointerException e) {
                     Log.e(TAG, "Couldn't understand the intent");
                     return null;
                 } catch (SecurityException e) {



More information about the Android mailing list