Skip to content

Commit

Permalink
fix(android): Provide a file name when an image is saved to the galle…
Browse files Browse the repository at this point in the history
…ry to prevent crash (#3331)
  • Loading branch information
iphilgood authored Jul 27, 2020
1 parent 519ead8 commit a7b9320
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,9 @@ private void returnResult(PluginCall call, Bitmap bitmap, Uri u) {
boolean saveToGallery = call.getBoolean("saveToGallery", CameraSettings.DEFAULT_SAVE_IMAGE_TO_GALLERY);
if (saveToGallery && (imageEditedFileSavePath != null || imageFileSavePath != null)) {
try {
String fileToSave = imageEditedFileSavePath != null ? imageEditedFileSavePath : imageFileSavePath;
MediaStore.Images.Media.insertImage(getActivity().getContentResolver(), fileToSave, "", "");
String fileToSavePath = imageEditedFileSavePath != null ? imageEditedFileSavePath : imageFileSavePath;
File fileToSave = new File(fileToSavePath);
MediaStore.Images.Media.insertImage(getActivity().getContentResolver(), fileToSavePath, fileToSave.getName(), "");
} catch (FileNotFoundException e) {
Logger.error(getLogTag(), IMAGE_GALLERY_SAVE_ERROR, e);
}
Expand Down

0 comments on commit a7b9320

Please sign in to comment.