-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: App crashes on clicking Save (EditActivity) #5632
Comments
If you don't mind can i work on this? |
Hey @neeldoshii, can you please reproduce this issue first (Since it happens only for specific images). Maybe for those without exif data. |
Reproduced. For me the bug happened to me at first image. Not sure what its causing, I am investigating it. This is giving crash to me everytime. |
Great 👏 @neeldoshii , I feel this issue is caused by images with no exif data (as the logs suggest) |
Thank you @kanahia1 a lot for this, it helped me exactly for a pinned point for the cause of issue and fix. Below is the code patch that fun getRotatedImage() {
val filePath = imageUri.toUri().path
val file = filePath?.let { File(it) }
val rotatedImage = file?.let { vm.rotateImage(imageRotation, it) }
if (rotatedImage == null) {
Toast.makeText(this, "Failed to rotate to image", Toast.LENGTH_LONG).show()
}
- val editedImageExif = rotatedImage?.path?.let { ExifInterface(it) }
- copyExifData(editedImageExif)
+ val editedImageExif: ExifInterface?
+ if (rotatedImage?.path != null) {
+ editedImageExif = ExifInterface(rotatedImage.path)
+ copyExifData(editedImageExif)
+ }
val resultIntent = Intent()
resultIntent.putExtra("editedImageFilePath", rotatedImage?.toUri()?.path ?: "Error");
setResult(RESULT_OK, resultIntent);
finish();
} If you would like, I can submit a pull request with this fix, or if you prefers to work on it, use this patch and this will fix the app crash. CC : @nicolas-raoul when we have no exif data of image do we want to show snackbar/toast to user that this image doesn't contain exif information? |
Assigning to Kanahia due to "Would you like to work on the issue? Yes" The app already sends a warning when the picture seems to not have been taken by the user, we use EXIF presence to detect this. So no need to send another warning. :-) |
Sure @nicolas-raoul, I have fixed the issue can I provide the next updated patch for @kanahia1 for reference? |
Ah yes of course, and I am very sorry for the delay in assigning this! |
Did a quite more digging this PR #5569 solves this issue once it gets merged. |
Hey @neeldoshii, Thank you for your work. If possible, can you please share the updated patch? |
As said, this issue is already solved in PR #5569 |
Strangely I am not able to reproduce this crash. |
Here are the steps
Basically crash happens when the image doesn't have any exif data at all. |
Indeed I am now able to reproduce, thanks! |
Summary
App crashes on rotating image and clicking on save on few images.
Steps to reproduce
Expected behaviour
App should not crash and rotated image should be shown
Actual behaviour
App crashes
Device name
Samsung S21
Android version
Android 14
Commons app version
4.2.1-debug-issues5439
Device logs
Screen-shots
WhatsApp.Video.2024-03-20.at.12.19.24_c0b948ec.mp4
Would you like to work on the issue?
Yes
The text was updated successfully, but these errors were encountered: