From 7eff06206d5ff76097656b9b0f9b148a748c649e Mon Sep 17 00:00:00 2001 From: Bodhi Mulders Date: Sun, 27 Dec 2020 16:02:53 +0100 Subject: [PATCH] [camera] Fix video recording exception on Android (#3375) * Fixed video recording * Update changelog and pubspec version * Update packages/camera/camera/CHANGELOG.md Co-authored-by: Maurits van Beusekom Co-authored-by: Maurits van Beusekom --- packages/camera/camera/CHANGELOG.md | 4 ++++ .../src/main/java/io/flutter/plugins/camera/Camera.java | 4 +++- packages/camera/camera/pubspec.yaml | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/camera/camera/CHANGELOG.md b/packages/camera/camera/CHANGELOG.md index 225601054fb9..461b2d927eda 100644 --- a/packages/camera/camera/CHANGELOG.md +++ b/packages/camera/camera/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.6.3+2 + +* Fixes crash on Android which occurs after video recording has stopped just before taking a picture. + ## 0.6.3+1 * Fixes flash & torch modes not working on some Android devices. diff --git a/packages/camera/camera/android/src/main/java/io/flutter/plugins/camera/Camera.java b/packages/camera/camera/android/src/main/java/io/flutter/plugins/camera/Camera.java index 0116ce3c0e4d..3c28d6655e48 100644 --- a/packages/camera/camera/android/src/main/java/io/flutter/plugins/camera/Camera.java +++ b/packages/camera/camera/android/src/main/java/io/flutter/plugins/camera/Camera.java @@ -276,7 +276,9 @@ public void onCaptureFailed( @NonNull CameraCaptureSession session, @NonNull CaptureRequest request, @NonNull CaptureFailure failure) { - assert (pictureCaptureRequest != null); + if (pictureCaptureRequest == null || pictureCaptureRequest.isFinished()) { + return; + } String reason; switch (failure.getReason()) { case CaptureFailure.REASON_ERROR: diff --git a/packages/camera/camera/pubspec.yaml b/packages/camera/camera/pubspec.yaml index 43a5fca3da21..1f5d06eecbe3 100644 --- a/packages/camera/camera/pubspec.yaml +++ b/packages/camera/camera/pubspec.yaml @@ -2,7 +2,7 @@ name: camera description: A Flutter plugin for getting information about and controlling the camera on Android and iOS. Supports previewing the camera feed, capturing images, capturing video, and streaming image buffers to dart. -version: 0.6.3+1 +version: 0.6.3+2 homepage: https://github.com/flutter/plugins/tree/master/packages/camera/camera dependencies: