aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-10-26 14:19:43 -0400
committerAllan Wang <me@allanwang.ca>2017-10-26 14:19:43 -0400
commitca12899e10da6e900499b7c4b99cc700cd5b9176 (patch)
treea8b0f6a1ed02ba00ac72636fa0588222d010326d
parent1cbee7747e6c7df56b1ab493297deec6763dd29c (diff)
downloadfrost-ca12899e10da6e900499b7c4b99cc700cd5b9176.tar.gz
frost-ca12899e10da6e900499b7c4b99cc700cd5b9176.tar.bz2
frost-ca12899e10da6e900499b7c4b99cc700cd5b9176.zip
Fix some null check warnings
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/services/DownloadService.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/AdBlocker.kt1
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostRequestInterceptor.kt3
-rw-r--r--docs/Changelog.md3
4 files changed, 6 insertions, 3 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/services/DownloadService.kt b/app/src/main/kotlin/com/pitchedapps/frost/services/DownloadService.kt
index 986467b8..fda5ebf5 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/services/DownloadService.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/services/DownloadService.kt
@@ -169,7 +169,7 @@ class DownloadService : IntentService("FrostVideoDownloader") {
private var totalBytesRead = 0L
- override fun read(sink: Buffer?, byteCount: Long): Long {
+ override fun read(sink: Buffer, byteCount: Long): Long {
val bytesRead = super.read(sink, byteCount)
// read() returns the number of bytes read, or -1 if this source is exhausted.
totalBytesRead += if (bytesRead != -1L) bytesRead else 0
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/AdBlocker.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/AdBlocker.kt
index 298453dd..c814ad4d 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/AdBlocker.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/AdBlocker.kt
@@ -28,6 +28,7 @@ open class AdBlocker(val assetPath: String) {
}
fun isAd(url: String?): Boolean {
+ url ?: return false
val httpUrl = HttpUrl.parse(url) ?: return false
return isAdHost(httpUrl.host())
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostRequestInterceptor.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostRequestInterceptor.kt
index fdec3238..f7f5666d 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostRequestInterceptor.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostRequestInterceptor.kt
@@ -39,7 +39,8 @@ private val adWhitelistHost: Set<String> =
)
fun WebView.shouldFrostInterceptRequest(request: WebResourceRequest): WebResourceResponse? {
- val httpUrl = HttpUrl.parse(request.url?.toString() ?: return null) ?: return null
+ request.url ?: return null
+ val httpUrl = HttpUrl.parse(request.url.toString()) ?: return null
val host = httpUrl.host()
val url = httpUrl.toString()
// if (blacklistHost.contains(host)) return blankResource
diff --git a/docs/Changelog.md b/docs/Changelog.md
index 4d419839..409f2c32 100644
--- a/docs/Changelog.md
+++ b/docs/Changelog.md
@@ -3,7 +3,8 @@
## v1.6.2
* Fix search update from Facebook
* Fix url parsing errors again
-* Fix pip for bottom bar (rotation still has issues)
+* Fix pip for bottom bar
+* Fix pip after rotation
## v1.6.0
* Add Spanish translations