[Bug] The deleted bookmark folder is still accessible and sometimes lead to crash
Describe the bug
I found that a bookmark folder was still accessible for a while after it was deleted. And this operation would sometimes lead to crash with exception like "
FATAL EXCEPTION: main Process: com.duckduckgo.mobile.android.debug, PID: 21320 java.lang.ArrayIndexOutOfBoundsException: length=10; index=-1 at java.util.ArrayList.get(ArrayList.java:439) at com.duckduckgo.savedsites.impl.bookmarks.BookmarkItemTouchHelperCallback.updateDragHandle(BookmarkItemTouchHelperCallback.kt:75) at com.duckduckgo.savedsites.impl.bookmarks.BookmarkItemTouchHelperCallback.clearView(BookmarkItemTouchHelperCallback.kt:63) at androidx.recyclerview.widget.ItemTouchHelper$3.onAnimationEnd(ItemTouchHelper.java:653) at android.animation.Animator$AnimatorListener.onAnimationEnd(Animator.java:552) at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1232) at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1474) at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146) at android.animation.AnimationHandler.access$100(AnimationHandler.java:37) at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:947) at android.view.Choreographer.doCallbacks(Choreographer.java:761) at android.view.Choreographer.doFrame(Choreographer.java:693) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:935) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
"
How to Reproduce
- Enter the app
- More Options
- Bookmarks
- Create a Parent folder
- Enter the Parent folder
- Create a Child folder
- Delete the Child folder
- Go to Search (will find all the Parent folder and the Child folder are all accessible)
- Enter the Parent folder (will find the Child folder is still there)
- Enter the Child folder (this step sometimes lead to the adforementioned crash)
- You can still do anything you want in the deleted Child folder
https://github.com/user-attachments/assets/e6e775da-46c0-45f9-a55f-334c5ddb1c35
Expected behavior
Although there is a short period for undo, I think the deleted folder should not be accesible at the time, or this would cause many potential problem.
Environment
- DDG App Version: 5.225.0
- Device: Pixel 8 pro
- OS: Android 13
Thank you for opening an Issue in our Repository. The issue has been forwarded to the team and we'll follow up as soon as we have time to investigate. As stated in our Contribution Guidelines, requests for feedback should be addressed via the Feedback section in the Android app.
Hi! I'd like to work on this issue. Could it be assigned to me?