Android: Make the handling of SAF open modes more robust

This commit is contained in:
JosJuice committed 2020-11-06 17:40:03 +01:00
1 parent 6a4ac74ec4
commit 70df5446d3
4 files changed
+43 -25

No files matched your search

@@ -17,7 +17,9 @@ public class ContentHandler
return DolphinApplication.getAppContext().getContentResolver()
.openFileDescriptor(Uri.parse(uri), mode).detachFd();
}
catch (FileNotFoundException | NullPointerException e)
// Some content providers throw IllegalArgumentException for invalid modes,
// despite the documentation saying that invalid modes result in a FileNotFoundException
catch (FileNotFoundException | IllegalArgumentException | NullPointerException e)
{
return -1;
}