Skip to content

Commit

Permalink
Don't crash on ill-formed URLs (#1084)
Browse files Browse the repository at this point in the history
  • Loading branch information
FooIbar authored Aug 6, 2024
1 parent 04db46f commit 854474f
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import eu.kanade.tachiyomi.util.system.openInBrowser
import eu.kanade.tachiyomi.util.system.toShareIntent
import eu.kanade.tachiyomi.util.system.toast
import logcat.LogPriority
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import tachiyomi.core.common.util.system.logcat
import tachiyomi.domain.source.service.SourceManager
import uy.kohesive.injekt.Injekt
Expand Down Expand Up @@ -47,7 +47,9 @@ class WebViewScreenModel(
}

fun clearCookies(url: String) {
val cleared = network.cookieJar.remove(url.toHttpUrl())
logcat { "Cleared $cleared cookies for: $url" }
url.toHttpUrlOrNull()?.let {
val cleared = network.cookieJar.remove(it)
logcat { "Cleared $cleared cookies for: $url" }
}
}
}

0 comments on commit 854474f

Please sign in to comment.