Skip to content

Commit

Permalink
[image_picker] Fixed a crash that would occur when called in quick su…
Browse files Browse the repository at this point in the history
…ccession on Android (flutter#1093)
  • Loading branch information
wouterhardeman authored and Chris Yang committed Jan 31, 2019
1 parent aedcc6f commit 0f9fbe4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions packages/image_picker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.5.0+1

* Fix a crash when user calls the plugin in quick succession on Android.

## 0.5.0

* **Breaking change**. Migrate from the deprecated original Android Support
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public void onScanCompleted(String path, Uri uri) {

public void chooseVideoFromGallery(MethodCall methodCall, MethodChannel.Result result) {
if (!setPendingMethodCallAndResult(methodCall, result)) {
finishWithAlreadyActiveError();
finishWithAlreadyActiveError(result);
return;
}

Expand All @@ -208,7 +208,7 @@ private void launchPickVideoFromGalleryIntent() {

public void takeVideoWithCamera(MethodCall methodCall, MethodChannel.Result result) {
if (!setPendingMethodCallAndResult(methodCall, result)) {
finishWithAlreadyActiveError();
finishWithAlreadyActiveError(result);
return;
}

Expand Down Expand Up @@ -242,7 +242,7 @@ private void launchTakeVideoWithCameraIntent() {

public void chooseImageFromGallery(MethodCall methodCall, MethodChannel.Result result) {
if (!setPendingMethodCallAndResult(methodCall, result)) {
finishWithAlreadyActiveError();
finishWithAlreadyActiveError(result);
return;
}

Expand All @@ -264,7 +264,7 @@ private void launchPickImageFromGalleryIntent() {

public void takeImageWithCamera(MethodCall methodCall, MethodChannel.Result result) {
if (!setPendingMethodCallAndResult(methodCall, result)) {
finishWithAlreadyActiveError();
finishWithAlreadyActiveError(result);
return;
}

Expand Down Expand Up @@ -482,8 +482,8 @@ private void finishWithSuccess(String imagePath) {
clearMethodCallAndResult();
}

private void finishWithAlreadyActiveError() {
finishWithError("already_active", "Image picker is already active");
private void finishWithAlreadyActiveError(MethodChannel.Result result) {
result.error("already_active", "Image picker is already active", null);
}

private void finishWithError(String errorCode, String errorMessage) {
Expand Down
2 changes: 1 addition & 1 deletion packages/image_picker/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors:
- Flutter Team <flutter-dev@googlegroups.com>
- Rhodes Davis Jr. <rody.davis.jr@gmail.com>
homepage: https://github.com/flutter/plugins/tree/master/packages/image_picker
version: 0.5.0
version: 0.5.0+1

flutter:
plugin:
Expand Down

0 comments on commit 0f9fbe4

Please sign in to comment.