Skip to content

Commit 914097b

Browse files
committed
Add null safety to host
1 parent 5c0da09 commit 914097b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

app/src/main/java/com/duckduckgo/app/httpsupgrade/HttpsUpgrader.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,12 @@ class HttpsUpgraderImpl(
5353
return false
5454
}
5555

56+
val host = uri.host ?: return false
57+
5658
waitForAnyReloadsToComplete()
5759

58-
val host = uri.host
5960
if (whitelistedDao.contains(host)) {
60-
Timber.d("${host} is in whitelist and so not upgradable")
61+
Timber.d("$host is in whitelist and so not upgradable")
6162
return false
6263
}
6364

@@ -66,7 +67,7 @@ class HttpsUpgraderImpl(
6667
val initialTime = System.nanoTime()
6768
val shouldUpgrade = it.contains(host)
6869
val totalTime = System.nanoTime() - initialTime
69-
Timber.d("${host} ${if (shouldUpgrade) "is" else "is not"} upgradable, lookup in ${totalTime / NANO_TO_MILLIS_DIVISOR}ms")
70+
Timber.d("$host ${if (shouldUpgrade) "is" else "is not"} upgradable, lookup in ${totalTime / NANO_TO_MILLIS_DIVISOR}ms")
7071

7172
return shouldUpgrade
7273
}

0 commit comments

Comments
 (0)