Fix crashes when files where not listed in the media store

This commit is contained in:
Karim Abou Zeid 2018-05-01 19:26:21 +02:00
commit 7d562070f5
3 changed files with 57 additions and 33 deletions

View file

@ -153,11 +153,8 @@ public final class FileUtil {
return false;
}
String fileTypeMainType = fileType.substring(0, fileTypeDelimiter);
if (fileTypeMainType.equals(mimeTypeMainType)) {
return true;
}
return fileTypeMainType.equals(mimeTypeMainType);
}
return false;
}
public static String stripExtension(String str) {
@ -194,4 +191,13 @@ public final class FileUtil {
return file.getAbsolutePath();
}
}
public static File safeGetCanonicalFile(File file) {
try {
return file.getCanonicalFile();
} catch (IOException e) {
e.printStackTrace();
return file.getAbsoluteFile();
}
}
}