Fix crashes when files where not listed in the media store
This commit is contained in:
parent
b1a086eaf2
commit
7d562070f5
3 changed files with 57 additions and 33 deletions
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue