Ashinch / ReadYou

An Android RSS reader presented in Material You style.
GNU General Public License v3.0
5.13k stars 202 forks source link

NullPointerException with yarr's Fever API implementation #867

Open valpackett opened 1 week ago

valpackett commented 1 week ago

(Current version on F-Droid, 0.10.1)

When connecting to yarr's Fever endpoint no articles show up.. and no error either because the error toast fails with an exception as well. logcat:

1731357576.769 10425   965 26827 I RLog    : doWork:
1731357576.790 10425   965   965 I RLog    : pullImportant: accountId: 2, isStarred: false, isUnread: false
1731357576.887 10425   965 25481 E RLog    : On sync exception: null
1731357576.887 10425   965 25481 E RLog    : java.lang.NullPointerException
1731357576.887 10425   965 25481 E RLog    :  at me.ash.reader.domain.service.FeverRssService$sync$2.invokeSuspend(FeverRssService.kt:1493)
1731357576.887 10425   965 25481 E RLog    :  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:9)
1731357576.887 10425   965 25481 E RLog    :  at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:111)
1731357576.887 10425   965 25481 E RLog    :  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:96)
1731357576.889  1000  2843  6871 I NotificationService: cancelToast pkg=me.ash.reader token=android.os.BinderProxy@c6d2cf8
1731357576.889  1000  2843  6871 W NotificationService: Toast already cancelled. pkg=me.ash.reader token=android.os.BinderProxy@c6d2cf8
1731357576.890 10425   965  1005 E WM-WorkerWrapper: Work [ id=3af45b58-efee-4c88-b917-bafc9099c053, tags={ me.ash.reader.domain.service.SyncWorker, ReadYou } ] failed because it threw an exception/error
1731357576.890 10425   965  1005 E WM-WorkerWrapper: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: You must either set a text or a view
1731357576.890 10425   965  1005 E WM-WorkerWrapper:  at androidx.work.impl.utils.futures.AbstractFuture.getDoneValue$1(AbstractFuture.java:21)
1731357576.890 10425   965  1005 E WM-WorkerWrapper:  at androidx.work.impl.utils.futures.AbstractFuture.get(AbstractFuture.java:67)
1731357576.890 10425   965  1005 E WM-WorkerWrapper:  at androidx.work.impl.WorkerWrapper$2.run(WorkerWrapper.java:7)
1731357576.890 10425   965  1005 E WM-WorkerWrapper:  at androidx.work.impl.utils.SerialExecutorImpl$Task.run(SerialExecutorImpl.java:3)
1731357576.890 10425   965  1005 E WM-WorkerWrapper:  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
1731357576.890 10425   965  1005 E WM-WorkerWrapper:  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
1731357576.890 10425   965  1005 E WM-WorkerWrapper:  at java.lang.Thread.run(Thread.java:1012)
1731357576.890 10425   965  1005 E WM-WorkerWrapper: Caused by: java.lang.IllegalStateException: You must either set a text or a view
1731357576.890 10425   965  1005 E WM-WorkerWrapper:  at com.android.internal.util.Preconditions.checkState(Preconditions.java:215)
1731357576.890 10425   965  1005 E WM-WorkerWrapper:  at android.widget.Toast.show(Toast.java:199)
1731357576.890 10425   965  1005 E WM-WorkerWrapper:  at me.ash.reader.ui.ext.ContextExtKt.showToast(ContextExt.kt:21)
1731357576.890 10425   965  1005 E WM-WorkerWrapper:  at me.ash.reader.ui.ext.ContextExtKt.showToast$default(ContextExt.kt:6)
1731357576.890 10425   965  1005 E WM-WorkerWrapper:  at me.ash.reader.domain.service.FeverRssService$sync$2$8.invokeSuspend(FeverRssService.kt:25)
1731357576.890 10425   965  1005 E WM-WorkerWrapper:  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:9)
1731357576.890 10425   965  1005 E WM-WorkerWrapper:  at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:111)
1731357576.890 10425   965  1005 E WM-WorkerWrapper:  at android.os.Handler.handleCallback(Handler.java:1000)
1731357576.890 10425   965  1005 E WM-WorkerWrapper:  at android.os.Handler.dispatchMessage(Handler.java:104)
1731357576.890 10425   965  1005 E WM-WorkerWrapper:  at android.os.Looper.loopOnce(Looper.java:242)
1731357576.890 10425   965  1005 E WM-WorkerWrapper:  at android.os.Looper.loop(Looper.java:362)
1731357576.890 10425   965  1005 E WM-WorkerWrapper:  at android.app.ActivityThread.main(ActivityThread.java:8448)
1731357576.890 10425   965  1005 E WM-WorkerWrapper:  at java.lang.reflect.Method.invoke(Native Method)
1731357576.890 10425   965  1005 E WM-WorkerWrapper:  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
1731357576.890 10425   965  1005 E WM-WorkerWrapper:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:992)
1731357576.892 10425   965  1005 I WM-WorkerWrapper: Worker result FAILURE for Work [ id=3af45b58-efee-4c88-b917-bafc9099c053, tags={ me.ash.reader.domain.service.SyncWorker, ReadYou } ]

…not sure what FeverRssService.kt:1493 is in a file with 348 lines :)

But after a quick look at the code and the responses, I think it's this:

https://github.com/Ashinch/ReadYou/blob/688eabd8f12d2cde09b9c58b4a1eacd8fdbb37c8/app/src/main/java/me/ash/reader/domain/service/FeverRssService.kt#L178

It !! assumes that every feed has been found in a group, while the feeds response from yarr has an empty feeds_groups array:

{
    "api_version": 3,
    "auth": 1,
    "feeds": [
        {
            "id": 2,
            "favicon_id": 2,
            "title": "Val Packett's Blog",
            "url": "https://val.packett.cool/feed.json",
            "site_url": "https://val.packett.cool/",
            "is_spark": 0,
            "last_updated_on_time": 1731348555
        },
        // …
    ],
    "feeds_groups": [],
    "last_refreshed_on_time": 1731348555
}

Reeder 5, Newsflash, and various other clients don't have any problem with this.