nextcloud / android

📱 Nextcloud Android app
https://play.google.com/store/apps/details?id=com.nextcloud.client
GNU General Public License v2.0
4.32k stars 1.78k forks source link

`ArrayIndexOutOfBoundsException` in `OCFileListAdapter.getItem()` #10613

Open weinic opened 2 years ago

weinic commented 2 years ago

⚠️ Before posting ⚠️

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

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

Device information

Firmware

Server error logs

No response

Additional information

No response

joshtrichards commented 3 months ago

Possibly a similar fixed as used for GalleryAdapter would work for OCFileListAdapter here - e.g. #10253

Do you have any way of reproducing this problem on demand, @weinic, by chance?