diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index edd9ecf..690c0d1 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -1729,7 +1729,7 @@ int pn53x_initiator_target_is_present(struct nfc_device *pnd, const nfc_target *pnt) { // Check if the argument target nt is equals to current saved target - if (!pn53x_current_target_is(pnd, pnt)) { + if ((pnt != NULL) && (!pn53x_current_target_is(pnd, pnt))) { return NFC_ETGRELEASED; } diff --git a/libnfc/nfc.c b/libnfc/nfc.c index 37fa413..dcfd409 100644 --- a/libnfc/nfc.c +++ b/libnfc/nfc.c @@ -836,7 +836,9 @@ nfc_initiator_transceive_bytes_timed(nfc_device *pnd, * @brief Check target presence * @return Returns 0 on success, otherwise returns libnfc's error code. * - * This function tests if \a nfc_target is currently present on NFC device. + * @param pnd \a nfc_device struct pointer that represent currently used device + * @param pnt a \a nfc_target struct pointer where desired target information was stored (optionnal, can be \e NULL). + * This function tests if \a nfc_target (or last selected tag if \e NULL) is currently present on NFC device. * @warning The target have to be selected before check its presence * @warning To run the test, one or more commands will be sent to target */