Prevent from segfault when nfc_disconnect() on NULL pointer

This commit is contained in:
Romuald Conty 2010-08-11 16:38:22 +00:00
parent 9cc31f6aad
commit d11e7a1320

View file

@ -234,6 +234,7 @@ nfc_device_t* nfc_connect(nfc_device_desc_t* pndd)
*/ */
void nfc_disconnect(nfc_device_t* pnd) void nfc_disconnect(nfc_device_t* pnd)
{ {
if(pnd) {
// Release and deselect all active communications // Release and deselect all active communications
nfc_initiator_deselect_target(pnd); nfc_initiator_deselect_target(pnd);
// Disable RF field to avoid heating // Disable RF field to avoid heating
@ -241,6 +242,7 @@ void nfc_disconnect(nfc_device_t* pnd)
// Disconnect, clean up and release the device // Disconnect, clean up and release the device
pnd->pdc->disconnect(pnd); pnd->pdc->disconnect(pnd);
} }
}
/** /**
* @brief Configure advanced NFC device settings * @brief Configure advanced NFC device settings