Show error message on invalid QR code.

This commit is contained in:
Dain Nilsson 2023-08-30 10:20:05 +02:00
parent d59cb0f9cd
commit 01cc8aa6f7
No known key found for this signature in database
GPG Key ID: F04367096FBA95E8

View File

@ -70,7 +70,13 @@ Future<void> handleUri(
OathState? state,
AppLocalizations l10n,
) async {
List<CredentialData> creds = CredentialData.fromUri(Uri.parse(qrData));
List<CredentialData> creds;
try {
creds = CredentialData.fromUri(Uri.parse(qrData));
} catch (_) {
showMessage(context, l10n.l_invalid_qr);
return;
}
if (creds.isEmpty) {
showMessage(context, l10n.l_qr_not_found);
} else if (creds.length == 1) {