Skip to content

Commit b05b980

Browse files
committed
Defend better against null getCertificate results
1 parent 573c063 commit b05b980

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/src/main/java/tech/httptoolkit/android/ProxySetup.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,9 @@ fun whereIsCertTrusted(proxyConfig: ProxyConfig): String? {
179179
val aliases = keyStore.aliases()
180180

181181
val proxyCertAliases = aliases.toList().filter { alias ->
182-
val storedCertData = keyStore.getCertificate(alias).encoded
183-
return@filter storedCertData != null && storedCertData.contentEquals(proxyCertData)
182+
val storedCert = keyStore.getCertificate(alias)
183+
val certData = storedCert?.encoded
184+
return@filter certData != null && certData.contentEquals(proxyCertData)
184185
}
185186

186187
Log.i(TAG, "Proxy cert aliases: $proxyCertAliases")

0 commit comments

Comments
 (0)