From a3c0067d38aba75326e30727571ea6772778c382 Mon Sep 17 00:00:00 2001 From: parsable-bratislavbatinic <138765136+parsable-bratislavbatinic@users.noreply.github.com> Date: Tue, 12 Sep 2023 12:01:16 +0200 Subject: [PATCH] Update CreateThumbnailModule.java https://github.com/souvik-ghosh/react-native-create-thumbnail/issues/98 --- .../java/com/createthumbnail/CreateThumbnailModule.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/createthumbnail/CreateThumbnailModule.java b/android/src/main/java/com/createthumbnail/CreateThumbnailModule.java index 9bd67d8..aca2dde 100644 --- a/android/src/main/java/com/createthumbnail/CreateThumbnailModule.java +++ b/android/src/main/java/com/createthumbnail/CreateThumbnailModule.java @@ -189,7 +189,12 @@ private static Bitmap getBitmapAtTime(Context context, String filePath, int time } Bitmap image = retriever.getFrameAtTime(time * 1000, MediaMetadataRetriever.OPTION_CLOSEST_SYNC); - retriever.release(); + try { + retriever.release(); + } catch (Exception e) { // Catching Exception class as it's unclear what specific exception you're facing + // Handle or log the exception here + e.printStackTrace(); + } if (image == null) { throw new IllegalStateException("File doesn't exist or not supported"); }