From bbfc0285a560316c1e2c7737f4532170f8aaea2b Mon Sep 17 00:00:00 2001 From: mimi89999 Date: Sat, 27 Dec 2025 11:05:26 +0100 Subject: [PATCH] Close NFC transport on TagLostException --- app/src/main/java/pl/lebihan/authnkey/NfcTransport.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/pl/lebihan/authnkey/NfcTransport.kt b/app/src/main/java/pl/lebihan/authnkey/NfcTransport.kt index 973c876..79e3553 100644 --- a/app/src/main/java/pl/lebihan/authnkey/NfcTransport.kt +++ b/app/src/main/java/pl/lebihan/authnkey/NfcTransport.kt @@ -1,5 +1,6 @@ package pl.lebihan.authnkey +import android.nfc.TagLostException import android.nfc.tech.IsoDep import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext @@ -73,6 +74,9 @@ class NfcTransport(private val isoDep: IsoDep) : FidoTransport { } fullResponse.toByteArray() + } catch (e: TagLostException) { + close() + throw e } catch (e: SecurityException) { // Tag is out of date / disconnected throw java.io.IOException("NFC connection lost")