diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-10-15 19:27:44 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-10-15 19:27:44 +0200 |
commit | f7bb5d6896c7bf7c503e49e5d97f4605acf630c2 (patch) | |
tree | 2a57acc72339ed31ae5fd7595531549953569fbd /src/main/java/de | |
parent | b071ff61d8de6ab00ae04fd4adfc795b5725447e (diff) |
don't crash if runtime could not be retrieved
Diffstat (limited to 'src/main/java/de')
-rw-r--r-- | src/main/java/de/pixart/messenger/persistance/FileBackend.java | 6 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java | 1 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java index 32e6c72ab..f942ba8c5 100644 --- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java +++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java @@ -948,7 +948,11 @@ public class FileBackend { private static Dimensions getVideoDimensions(Context context, Uri uri) throws NotAVideoFile { MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever(); - mediaMetadataRetriever.setDataSource(context, uri); + try { + mediaMetadataRetriever.setDataSource(context, uri); + } catch (Exception e) { + throw new NotAVideoFile(); + } return getVideoDimensions(mediaMetadataRetriever); } diff --git a/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java b/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java index 2df3ab86c..207267d0b 100644 --- a/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java +++ b/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java @@ -83,7 +83,6 @@ public class AttachFileToConversationRunnable implements Runnable, MediaTranscod SimpleDateFormat fileDateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US); message.setRelativeFilePath(fileDateFormat.format(new Date(message.getTimeSent())) + "_" + message.getUuid().substring(0, 4) + "_komp.mp4"); final DownloadableFile file = mXmppConnectionService.getFileBackend().getFile(message); - final int runtime = mXmppConnectionService.getFileBackend().getMediaRuntime(uri); file.getParentFile().mkdirs(); final ParcelFileDescriptor parcelFileDescriptor = mXmppConnectionService.getContentResolver().openFileDescriptor(uri, "r"); if (parcelFileDescriptor == null) { |