Skip to content

Commit

Permalink
avoid crash when NC notification could not be retrieved
Browse files Browse the repository at this point in the history
crash:

              E  Failed to get NC notification
                                                                                                    retrofit2.adapter.rxjava2.HttpException: HTTP 404
                                                                                                    	at retrofit2.adapter.rxjava2.BodyObservable$BodyObserver.onNext(BodyObservable.java:57)
                                                                                                    	at retrofit2.adapter.rxjava2.BodyObservable$BodyObserver.onNext(BodyObservable.java:38)
                                                                                                    	at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:48)
                                                                                                    	at io.reactivex.Observable.subscribe(Observable.java:12284)
                                                                                                    	at retrofit2.adapter.rxjava2.BodyObservable.subscribeActual(BodyObservable.java:35)
                                                                                                    	at io.reactivex.Observable.subscribe(Observable.java:12284)
                                                                                                    	at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
                                                                                                    	at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:608)
                                                                                                    	at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
                                                                                                    	at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
                                                                                                    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
                                                                                                    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
                                                                                                    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
                                                                                                    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
                                                                                                    	at java.lang.Thread.run(Thread.java:919)
2023-11-30 10:48:11.049  5352-5597  WM-WorkerWrapper        com.nextcloud.talk2                  I  Worker result SUCCESS for Work [ id=f899eadb-9fd0-4bdf-8cdf-a1ea4a1aa11b, tags={ com.nextcloud.talk.jobs.NotificationWorker } ]
2023-11-30 10:48:11.056  5352-5352  AndroidRuntime          com.nextcloud.talk2                  D  Shutting down VM
2023-11-30 10:48:11.058  5352-5352  AndroidRuntime          com.nextcloud.talk2                  E  FATAL EXCEPTION: main
                                                                                                    Process: com.nextcloud.talk2, PID: 5352
                                                                                                    java.lang.IllegalArgumentException: No suitable parent found from the given view. Please provide a valid view.
                                                                                                    	at com.google.android.material.snackbar.Snackbar.makeInternal(Snackbar.java:200)

Signed-off-by: Marcel Hibbe <[email protected]>
  • Loading branch information
mahibi committed Nov 30, 2023
1 parent ae8495a commit cc6f3ff
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import android.service.notification.StatusBarNotification
import android.text.TextUtils
import android.util.Base64
import android.util.Log
import android.view.View
import android.widget.Toast
import androidx.core.app.ActivityCompat
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
Expand All @@ -56,7 +56,6 @@ import androidx.work.Worker
import androidx.work.WorkerParameters
import autodagger.AutoInjector
import com.bluelinelabs.logansquare.LoganSquare
import com.google.android.material.snackbar.Snackbar
import com.nextcloud.talk.BuildConfig
import com.nextcloud.talk.R
import com.nextcloud.talk.activities.MainActivity
Expand Down Expand Up @@ -329,11 +328,7 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor
Log.e(TAG, "Failed to get NC notification", e)
if (BuildConfig.DEBUG) {
Handler(Looper.getMainLooper()).post {
Snackbar.make(
View(applicationContext),
"Failed to get NC notification",
Snackbar.LENGTH_LONG
).show()
Toast.makeText(context, "Failed to get NC notification", Toast.LENGTH_LONG).show()
}
}
}
Expand Down

0 comments on commit cc6f3ff

Please sign in to comment.