Fix crashes

pull/355/head
Koitharu 3 years ago
parent 1b64c2a330
commit 262e26a0cc
No known key found for this signature in database
GPG Key ID: 8E861F8CE6E7CE27

@ -5,5 +5,5 @@ import okio.IOException
class CloudFlareProtectedException(
val url: String,
val headers: Headers,
@Transient val headers: Headers,
) : IOException("Protected by CloudFlare")

@ -1,3 +1,3 @@
package org.koitharu.kotatsu.core.exceptions
class WrongPasswordException : SecurityException()
class WrongPasswordException : IllegalArgumentException()

@ -14,6 +14,7 @@ import org.koitharu.kotatsu.parsers.model.Manga
import org.koitharu.kotatsu.parsers.model.MangaChapter
import org.koitharu.kotatsu.parsers.model.MangaSource
import org.koitharu.kotatsu.utils.ext.getParcelableExtraCompat
import org.koitharu.kotatsu.utils.ext.printStackTraceDebug
import org.koitharu.kotatsu.utils.ext.runCatchingCancellable
import javax.inject.Inject
@ -95,7 +96,12 @@ class MangaPrefetchService : CoroutineIntentService() {
val intent = Intent(context, MangaPrefetchService::class.java)
intent.action = ACTION_PREFETCH_PAGES
intent.putExtra(EXTRA_CHAPTER, ParcelableMangaChapters(listOf(chapter)))
context.startService(intent)
try {
context.startService(intent)
} catch (e: IllegalStateException) {
// probably app is in background
e.printStackTraceDebug()
}
}
fun prefetchLast(context: Context) {

Loading…
Cancel
Save