From 055cacdd9143ef89a92a97170ac3c22a9aeda392 Mon Sep 17 00:00:00 2001 From: Bastian Köcher Date: Thu, 16 May 2019 09:49:18 +0200 Subject: Fix finding Otp digits (#511) If no `digits` was present, this function failed with a `NullPointerException`. --- app/src/main/java/com/zeapo/pwdstore/PasswordEntry.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/src') diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordEntry.kt b/app/src/main/java/com/zeapo/pwdstore/PasswordEntry.kt index 392bc749..0fad38d7 100644 --- a/app/src/main/java/com/zeapo/pwdstore/PasswordEntry.kt +++ b/app/src/main/java/com/zeapo/pwdstore/PasswordEntry.kt @@ -89,8 +89,8 @@ class PasswordEntry(private val content: String) { private fun findOtpDigits(decryptedContent: String): String { decryptedContent.split("\n".toRegex()).forEach { line -> - if (line.startsWith("otpauth://totp/") || - line.startsWith("otpauth://hotp/") && + if ((line.startsWith("otpauth://totp/") || + line.startsWith("otpauth://hotp/")) && Uri.parse(line).getQueryParameter("digits") != null) { return Uri.parse(line).getQueryParameter("digits")!! } -- cgit v1.2.3