-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix: IndexOutOfBoundsException crash when removing last two images of multiupload #6124
base: main
Are you sure you want to change the base?
Conversation
Looks great, thanks! |
549ca38
to
43eb577
Compare
Done 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am getting this crash when trying to remove the middle picture, any idea what might be the issue? 🙂
APP_VERSION_NAME=5.1.2-debug-rohit9625-fix-multiupload
ANDROID_VERSION=15
PHONE_MODEL=Pixel 9 Pro
STACK_TRACE=kotlin.UninitializedPropertyAccessException: lateinit property basicKvStoreFactory has not been initialized
at fr.free.nrw.commons.upload.mediaDetails.UploadMediaPresenter.getBasicKvStoreFactory(UploadMediaPresenter.kt:54)
at fr.free.nrw.commons.upload.mediaDetails.UploadMediaPresenter.updateImageQualitiesJSON(UploadMediaPresenter.kt:366)
at fr.free.nrw.commons.upload.UploadPresenter.deletePictureAtIndex(UploadPresenter.kt:162)
at fr.free.nrw.commons.upload.UploadActivity.onThumbnailDeleted(UploadActivity.kt:776)
at fr.free.nrw.commons.upload.ThumbnailsAdapter$ViewHolder.bind$lambda$0(ThumbnailsAdapter.kt:72)
at fr.free.nrw.commons.upload.ThumbnailsAdapter$ViewHolder.$r8$lambda$h9qbE-GosgolnpmsfOlWqsny9oU(Unknown Source:0)
at fr.free.nrw.commons.upload.ThumbnailsAdapter$ViewHolder$$ExternalSyntheticLambda1.onClick(D8$$SyntheticClass:0)
at android.view.View.performClick(View.java:8081)
at android.view.View.performClickInternal(View.java:8058)
at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
at android.view.View$PerformClick.run(View.java:31517)
at android.os.Handler.handleCallback(Handler.java:991)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:317)
at android.app.ActivityThread.main(ActivityThread.java:8934)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911)
Doesn't happen on my device. What are the exact steps you followed? |
I just tried the latest commit of this branch, I get the same crash: screen-20250119-073306.mp4 |
Did you try uninstalling and then installing again? Please try using a different triplet of images. |
Would you mind solving the conflict? |
Yeah sure :) |
Well, I believe it should not crash for any group of picture, even without reinstalling. :-) |
Yes, you're right. But, the error was about |
Description (required)
Fixes #6122
What changes did you make and why?
When removing images from
Thumbnails Row
, the uploadableImages property insideThubnailsAdapter
was not updating. It results in the image being removed at an invalid index and sometimesIndexOutOfBoundsException
.So, I added the code to notify the adapter that the image was removed.
Tests performed (required)
Tested ProdDebug on Samsung A14 with API level 34.
Screenshots (for UI changes only)
Screencast after fix
After_Fix.mp4