Skip to content

Commit 31df565

Browse files
panmariEgor
authored and
Egor
committed
[camera] Improving handling when camera permissions are not granted. (flutter#2848)
1 parent dcc82e0 commit 31df565

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

packages/camera/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.5.8+4
2+
3+
* Fixed bug caused by casting a `CameraAccessException` on Android.
4+
15
## 0.5.8+3
26

37
* Fix bug in usage example in README.md

packages/camera/android/src/main/java/io/flutter/plugins/camera/MethodCallHandlerImpl.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,10 @@ private void instantiateCamera(MethodCall call, Result result) throws CameraAcce
167167
private void handleException(Exception exception, Result result) {
168168
if (exception instanceof CameraAccessException) {
169169
result.error("CameraAccess", exception.getMessage(), null);
170+
return;
170171
}
171172

173+
// CameraAccessException can not be cast to a RuntimeException.
172174
throw (RuntimeException) exception;
173175
}
174176
}

packages/camera/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: camera
22
description: A Flutter plugin for getting information about and controlling the
33
camera on Android and iOS. Supports previewing the camera feed, capturing images, capturing video,
44
and streaming image buffers to dart.
5-
version: 0.5.8+3
5+
version: 0.5.8+4
66

77
homepage: https://github.com/flutter/plugins/tree/master/packages/camera
88

0 commit comments

Comments
 (0)