Просмотр исходного кода

Fix crash on updating trackers after reading with no network (closes #4207)

arkon 4 лет назад
Родитель
Сommit
3df98d576e

+ 6 - 2
app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt

@@ -673,14 +673,18 @@ class ReaderPresenter(
                         // We want these to execute even if the presenter is destroyed and leaks
                         // for a while. The view can still be garbage collected.
                         async {
-                            service.update(track)
-                            db.insertTrack(track).await()
+                            runCatching {
+                                service.update(track)
+                                db.insertTrack(track).await()
+                            }
                         }
                     } else {
                         null
                     }
                 }
                 .awaitAll()
+                .filter { it.isFailure }
+                .forEach { it.exceptionOrNull()?.let { e -> Timber.w(e) } }
         }
     }