diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/FileUtils.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/eu/siacs/conversations/utils/FileUtils.java b/src/main/java/eu/siacs/conversations/utils/FileUtils.java index ad8b8640..6e75d41c 100644 --- a/src/main/java/eu/siacs/conversations/utils/FileUtils.java +++ b/src/main/java/eu/siacs/conversations/utils/FileUtils.java @@ -10,6 +10,8 @@ import android.os.Environment; import android.provider.DocumentsContract; import android.provider.MediaStore; +import java.io.File; + public class FileUtils { /** @@ -77,7 +79,14 @@ public class FileUtils { } // MediaStore (and general) else if ("content".equalsIgnoreCase(uri.getScheme())) { - return getDataColumn(context, uri, null, null); + String path = getDataColumn(context, uri, null, null); + if (path != null) { + File file = new File(path); + if (!file.canRead()) { + return null; + } + } + return path; } // File else if ("file".equalsIgnoreCase(uri.getScheme())) { |