From 055cacdd9143ef89a92a97170ac3c22a9aeda392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Thu, 16 May 2019 09:49:18 +0200 Subject: [PATCH] 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(-) 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")!! }