Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
image_picker: clean up tmp files in case of error
Browse files Browse the repository at this point in the history
  • Loading branch information
Bubu committed Jun 24, 2021
1 parent 46adcfb commit c9cdd66
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,10 @@ private void launchTakeVideoWithCameraIntent() {
try {
activity.startActivityForResult(intent, REQUEST_CODE_TAKE_VIDEO_WITH_CAMERA);
} catch (ActivityNotFoundException e) {
4 finishWithError("no_available_camera", "No cameras available for taking pictures.");
// If we can't delete the file again here, there's not really anything we can do about it.
//noinspection ResultOfMethodCallIgnored
videoFile.delete();
finishWithError("no_available_camera", "No cameras available for taking pictures.");
}
}

Expand Down Expand Up @@ -366,6 +369,9 @@ private void launchTakeImageWithCameraIntent() {
try {
activity.startActivityForResult(intent, REQUEST_CODE_TAKE_IMAGE_WITH_CAMERA);
} catch (ActivityNotFoundException e) {
// If we can't delete the file again here, there's not really anything we can do about it.
//noinspection ResultOfMethodCallIgnored
imageFile.delete();
finishWithError("no_available_camera", "No cameras available for taking pictures.");
}
}
Expand Down

0 comments on commit c9cdd66

Please sign in to comment.