[Android] Catch SecurityException in FileUtils.getUri()

Geoffrey Métais git at videolan.org
Fri Apr 27 12:13:08 CEST 2018


vlc-android | branch: 3.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Apr 27 11:17:24 2018 +0200| [d3bf17813be39b9152205849c469073ef45185fa] | committer: Geoffrey Métais

Catch SecurityException in FileUtils.getUri()

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

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

diff --git a/vlc-android/src/org/videolan/vlc/util/FileUtils.java b/vlc-android/src/org/videolan/vlc/util/FileUtils.java
index fe7d50282..d26873697 100644
--- a/vlc-android/src/org/videolan/vlc/util/FileUtils.java
+++ b/vlc-android/src/org/videolan/vlc/util/FileUtils.java
@@ -120,11 +120,10 @@ public class FileUtils {
             final int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
             cursor.moveToFirst();
             return cursor.getString(column_index);
-        } catch (IllegalArgumentException e) {
+        } catch (IllegalArgumentException|SecurityException e) {
                 return "";
         } finally {
-            if (cursor != null && !cursor.isClosed())
-                cursor.close();
+            if (cursor != null && !cursor.isClosed()) cursor.close();
         }
     }
 



More information about the Android mailing list