summaryrefslogtreecommitdiffstats
path: root/src/nfc/qnearfieldtarget_android.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/nfc/qnearfieldtarget_android.cpp')
-rw-r--r--src/nfc/qnearfieldtarget_android.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nfc/qnearfieldtarget_android.cpp b/src/nfc/qnearfieldtarget_android.cpp
index c6b120e7..de59808c 100644
--- a/src/nfc/qnearfieldtarget_android.cpp
+++ b/src/nfc/qnearfieldtarget_android.cpp
@@ -253,6 +253,12 @@ QNearFieldTarget::RequestId NearFieldTarget::sendCommand(const QByteArray &comma
// Writing
QAndroidJniObject myNewVal = m_tagTech.callObjectMethod("transceive", "([B)[B", jba);
if (catchJavaExceptions()) {
+ // Some devices (Samsung, Huawei) throw an exception when the card is lost:
+ // "android.nfc.TagLostException: Tag was lost". But there seems to be a bug that
+ // isConnected still reports true. So we need to invalidate the target as soon as
+ // possible and treat the card as lost.
+ handleTargetLost();
+
reportError(QNearFieldTarget::CommandError, requestId);
return requestId;
}