Avoid crashing when clearing cookies for invalid source URLs
e.g. Komga sources with no URLs set
This commit is contained in:
parent
09cebf20f3
commit
b6d6de6b9f
@ -115,11 +115,16 @@ class ExtensionDetailsScreenModel(
|
|||||||
|
|
||||||
val urls = extension.sources
|
val urls = extension.sources
|
||||||
.filterIsInstance<HttpSource>()
|
.filterIsInstance<HttpSource>()
|
||||||
.map { it.baseUrl }
|
.mapNotNull { it.baseUrl.takeUnless { url -> url.isEmpty() } }
|
||||||
.distinct()
|
.distinct()
|
||||||
|
|
||||||
val cleared = urls.sumOf {
|
val cleared = urls.sumOf {
|
||||||
network.cookieManager.remove(it.toHttpUrl())
|
try {
|
||||||
|
network.cookieManager.remove(it.toHttpUrl())
|
||||||
|
} catch (e: Exception) {
|
||||||
|
logcat(LogPriority.ERROR, e) { "Failed to clear cookies for $it" }
|
||||||
|
0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logcat { "Cleared $cleared cookies for: ${urls.joinToString()}" }
|
logcat { "Cleared $cleared cookies for: ${urls.joinToString()}" }
|
||||||
|
Loading…
Reference in New Issue
Block a user