diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index 690c0d1..56679ea 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -1728,6 +1728,11 @@ pn53x_initiator_deselect_target(struct nfc_device *pnd) int pn53x_initiator_target_is_present(struct nfc_device *pnd, const nfc_target *pnt) { + // Check if there is a saved target + if (CHIP_DATA(pnd)->current_target == NULL) { + return NFC_ETGRELEASED; + } + // Check if the argument target nt is equals to current saved target if ((pnt != NULL) && (!pn53x_current_target_is(pnd, pnt))) { return NFC_ETGRELEASED;