Offline Sync Worker Crashes When the App Starts Without a Server Connection
- 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
- Start app without server connection
### Expected behaviour
Offline Sync Worker Should Not Crash When the App Starts With or Without Server Connection
### Actual behaviour
Offline Sync Worker Crashes When the App Starts Without a Server Connection
### Android version
15
### Device brand and model
Emulator
### Stock or custom OS?
Stock
### Nextcloud android app version
3.30.6
### Nextcloud server version
29.0.4
### Android logs
```
com.nextcloud.client E Work [ id=0555fa7d-f9fb-4a33-a5ed-bb0317e26c24, tags={ com.nextcloud.client.jobs.OfflineSyncWork, *, name:periodic_offline_sync, timestamp:1731680648444, class:OfflineSyncWork } ] failed because it threw an exception/error
java.util.concurrent.ExecutionException: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.util.ArrayList.get(int)' on a null object reference
at androidx.work.impl.utils.futures.AbstractFuture.getDoneValue(AbstractFuture.java:515)
at androidx.work.impl.utils.futures.AbstractFuture.get(AbstractFuture.java:474)
at androidx.work.impl.WorkerWrapper$2.run(WorkerWrapper.java:316)
at androidx.work.impl.utils.SerialExecutorImpl$Task.run(SerialExecutorImpl.java:96)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.util.ArrayList.get(int)' on a null object reference
at com.nextcloud.client.jobs.OfflineSyncWork.checkEtagChanged(OfflineSyncWork.kt:132)
at com.nextcloud.client.jobs.OfflineSyncWork.recursive(OfflineSyncWork.kt:68)
at com.nextcloud.client.jobs.OfflineSyncWork.doWork(OfflineSyncWork.kt:53)
at androidx.work.Worker$1.run(Worker.java:82)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)
```
Contributor guide
Assessment
This issue has not been assessed yet.