diff options
| author | JosJuice <josjuice@gmail.com> | 2020-11-08 12:37:32 +0100 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2020-11-08 23:05:34 +0100 |
| commit | 6df543fbc94b1b97c6544a212a8689687713057a (patch) | |
| tree | f11315999af0233722e658fbc1b7f4d6b33a25ec /Source/Android/app/src/main/java | |
| parent | 713d309386c7c3dbe851bc59ea548a06c28dc4bd (diff) | |
Android: Catch SecurityException in ContentHandler
Diffstat (limited to 'Source/Android/app/src/main/java')
| -rw-r--r-- | Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/ContentHandler.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/ContentHandler.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/ContentHandler.java index 7cf7c24253..c2fa96999f 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/ContentHandler.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/ContentHandler.java @@ -21,6 +21,11 @@ public class ContentHandler { return getContentResolver().openFileDescriptor(Uri.parse(uri), mode).detachFd(); } + catch (SecurityException e) + { + Log.error("Tried to open " + uri + " without permission"); + return -1; + } // Some content providers throw IllegalArgumentException for invalid modes, // despite the documentation saying that invalid modes result in a FileNotFoundException catch (FileNotFoundException | IllegalArgumentException | NullPointerException e) @@ -35,6 +40,11 @@ public class ContentHandler { return DocumentsContract.deleteDocument(getContentResolver(), Uri.parse(uri)); } + catch (SecurityException e) + { + Log.error("Tried to delete " + uri + " without permission"); + return false; + } catch (FileNotFoundException e) { // Return true because we care about the file not being there, not the actual delete. @@ -53,6 +63,10 @@ public class ContentHandler return cursor.getString(0); } } + catch (SecurityException e) + { + Log.error("Tried to get display name of " + uri + " without permission"); + } return null; } |
