Image editor: error handling

pull/217/head
M66B 9 months ago
parent 30dc1a470a
commit 63aab6af9c

@ -40,6 +40,7 @@ import com.canhub.cropper.CropImageView;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
public class FragmentDialogEditImage extends FragmentDialogBase {
@ -132,7 +133,8 @@ public class FragmentDialogEditImage extends FragmentDialogBase {
if (!TextUtils.isEmpty(ext) && !ext.equalsIgnoreCase("png")) {
File old = attachment.getFile(context);
attachment.name = attachment.name.substring(0, index) + ".png";
old.renameTo(attachment.getFile(context));
if (!old.renameTo(attachment.getFile(context)))
throw new IOException("Error renaming " + file.getAbsolutePath());
}
}
}

Loading…
Cancel
Save