Uploads view crashes after multiple file upload attempts
- Dominant language
- Kotlin
- Stars
- 5.6k
- Forks
- 2k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 92
Description
### ⚠️ Before posting ⚠️
- [x] This is a **bug**, not a question or an enhancement.
- [x] I've [searched for similar issues](https://github.com/nextcloud/android/issues) and didn't find a duplicate.
- [x] I've written a clear and descriptive title for this issue, not just "Bug" or "Crash".
- [x] I agree to follow Nextcloud's [Code of Conduct](https://nextcloud.com/contribute/code-of-conduct/).
### Steps to reproduce
1. Access some folders
2. Go to another file manager app, e.g. ZArchiver
3. Select some files there and click Share
4. Open up Android's share modal and choose Nextcloud
5. Select some folders
6. Create a new folder with : -> New folder, then go inside that and create a new folder again
7. Click Upload
8. Share function closes and user goes back to third-party file manager
9. Use Android's task view to go back to Nextcloud
10. Notice no files in there, wrongly assuming the file upload hasn't started yet
11. Go back to other file explorer app and upload the same multiple files to the same folder
12. Open up sidebar and open Uploads
13. Crash
### Expected behaviour
No crash log, the Uploads page should pop up with a list of files being uploaded
### Actual behaviour
The user is shown the log I've pasted below
### Android version
15
### Device brand and model
realme C53 (RMX3760)
### Stock or custom OS?
Stock
### Nextcloud android app version
30340190
### Nextcloud server version
Doesn't seem to be relevant
### Using a reverse proxy?
No
### Android logs
### Cause of error
```java
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index 1 out of bounds for length 0
at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
at java.util.Objects.checkIndex(Objects.java:391)
at java.util.ArrayList.get(ArrayList.java:434)
at com.google.android.material.internal.NavigationMenuPresenter$NavigationMenuAdapter.getItemViewType(NavigationMenuPresenter.java:570)
at com.google.android.material.internal.NavigationMenuPresenter$NavigationMenuAdapter.onBindViewHolder(NavigationMenuPresenter.java:604)
at com.google.android.material.internal.NavigationMenuPresenter$NavigationMenuAdapter.onBindViewHolder(NavigationMenuPresenter.java:540)
at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:7747)
at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7847)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:6646)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6917)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6757)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6753)
at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2362)
at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1662)
at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1622)
at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:687)
at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:4645)
at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:4348)
at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4919)
at android.view.View.layout(View.java:25828)
at android.view.ViewGroup.layout(ViewGroup.java:6638)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at android.view.View.layout(View.java:25828)
at android.view.ViewGroup.layout(ViewGroup.java:6638)
at androidx.drawerlayout.widget.DrawerLayout.onLayout(DrawerLayout.java:1287)
at android.view.View.layout(View.java:25828)
at android.view.ViewGroup.layout(ViewGroup.java:6638)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at android.view.View.layout(View.java:25828)
at android.view.ViewGroup.layout(ViewGroup.java:6638)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at android.view.View.layout(View.java:25828)
at android.view.ViewGroup.layout(ViewGroup.java:6638)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at android.view.View.layout(View.java:25828)
at android.view.ViewGroup.layout(ViewGroup.java:6638)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1891)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1729)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1638)
at android.view.View.layout(View.java:25828)
at android.view.ViewGroup.layout(ViewGroup.java:6638)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at com.android.internal.policy.DecorView.onLayout(DecorView.java:759)
at android.view.View.layout(View.java:25828)
at android.view.ViewGroup.layout(ViewGroup.java:6638)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:5261)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:4338)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:3163)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:10974)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1871)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1880)
at android.view.Choreographer.doCallbacks(Choreographer.java:1291)
at android.view.Choreographer.doFrame(Choreographer.java:1117)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1697)
at android.os.Handler.handleCallback(Handler.java:959)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:317)
at android.app.ActivityThread.main(ActivityThread.java:8927)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:681)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:915)
```
### App information
* ID: `com.nextcloud.client`
* Version: `30340190`
* Build flavor: `gplay`
### Device information
* Brand: `realme`
* Device: `RE58C2`
* Model: `RMX3760`
* Id: `AP3A.240905.015.A2`
* Product: `RMX3760`
### Firmware
* SDK: `35`
* Release: `15`
* Incremental: `562`
### Server error logs
```bash
```
### Additional information
A toast prompted me to report to GitHub so I was like "sure, why not?"
Contributor guide
Assessment
This issue has not been assessed yet.