nextcloud / nextcloud/android

`ArrayIndexOutOfBoundsException` in `OCFileListAdapter.getItem()`

Open
#10,613 1 comment 0 reactions 0 assignees View on GitHub
bug performance: misc stable-3.21
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.
- [ ] 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

By use the nc client at any times

### Expected behaviour

Empty

### Actual behaviour

Empty

### Android version

10

### Device brand and model

oneplus5

### Stock or custom OS?

Stock

### Nextcloud android app version

3.21.0

### Nextcloud server version

22

### Using a reverse proxy?

No

### Android logs

### Cause of error
```java
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: length=17; index=17
at java.util.ArrayList.get(ArrayList.java:439)
at com.owncloud.android.ui.adapter.OCFileListAdapter.getItem(OCFileListAdapter.java:561)
at com.owncloud.android.ui.adapter.OCFileListAdapter.getItemViewType(OCFileListAdapter.java:596)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6367)
at androidx.recyclerview.widget.GapWorker.prefetchPositionWithDeadline(GapWorker.java:288)
at androidx.recyclerview.widget.GapWorker.flushTaskWithDeadline(GapWorker.java:345)
at androidx.recyclerview.widget.GapWorker.flushTasksWithDeadline(GapWorker.java:361)
at androidx.recyclerview.widget.GapWorker.prefetch(GapWorker.java:368)
at androidx.recyclerview.widget.GapWorker.run(GapWorker.java:399)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7697)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)

```

### App information
* ID: `com.nextcloud.client`
* Version: `30210090`
* Build flavor: `gplay`

### Device information
* Brand: `OnePlus`
* Device: `OnePlus5`
* Model: `ONEPLUS A5000`
* Id: `QKQ1.191014.012`
* Product: `OnePlus5`

### Firmware
* SDK: `29`
* Release: `10`
* Incremental: `2010292059`

### Server error logs

_No response_

### Additional information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.