diff --git a/app/src/main/java/com/keylesspalace/tusky/util/MediaUtils.kt b/app/src/main/java/com/keylesspalace/tusky/util/MediaUtils.kt index 10d7ca7b..951132bd 100644 --- a/app/src/main/java/com/keylesspalace/tusky/util/MediaUtils.kt +++ b/app/src/main/java/com/keylesspalace/tusky/util/MediaUtils.kt @@ -113,7 +113,15 @@ fun getImageThumbnail(contentResolver: ContentResolver, uri: Uri, @Px thumbnailS fun getVideoThumbnail(context: Context, uri: Uri, @Px thumbnailSize: Int): Bitmap? { val retriever = MediaMetadataRetriever() - retriever.setDataSource(context, uri) + try { + retriever.setDataSource(context, uri) + } catch (e: IllegalArgumentException) { + Log.w(TAG, e) + return null + } catch (e: SecurityException) { + Log.w(TAG, e) + return null + } val source = retriever.frameAtTime ?: return null return ThumbnailUtils.extractThumbnail(source, thumbnailSize, thumbnailSize, ThumbnailUtils.OPTIONS_RECYCLE_INPUT) }