mirror of
https://github.com/brmlab/brmdoor_libnfc.git
synced 2025-06-07 08:04:06 +02:00
Fix race condition when card is removed during read and libfreefare returns list of just NULL pointer
This commit is contained in:
parent
5e4d16a857
commit
079db13938
1 changed files with 4 additions and 0 deletions
|
@ -165,6 +165,10 @@ std::string NFCDevice::readDesfireNDEF() throw(NFCError)
|
||||||
if (!tags) {
|
if (!tags) {
|
||||||
throw NFCError("No tags detected");
|
throw NFCError("No tags detected");
|
||||||
}
|
}
|
||||||
|
// freefare_get_tags() returns a NULL-terminated list of MifareTag
|
||||||
|
if (!*tags) {
|
||||||
|
throw NFCError("Empty array tag, bailing out");
|
||||||
|
}
|
||||||
MifareTag& tag = *tags; //only first one is used
|
MifareTag& tag = *tags; //only first one is used
|
||||||
|
|
||||||
if (DESFIRE != freefare_get_tag_type (tag)) {
|
if (DESFIRE != freefare_get_tag_type (tag)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue