diff --git a/brmdoor_nfc.cpp b/brmdoor_nfc.cpp index 015c8b8..7dc5a1f 100644 --- a/brmdoor_nfc.cpp +++ b/brmdoor_nfc.cpp @@ -65,6 +65,10 @@ std::string NFCDevice::scanUID() throw(NFCError) int res; nfc_target nt; + if (!opened()) { + throw NFCError("NFC device not opened"); + } + res = nfc_initiator_poll_target(_nfcDevice, _modulations, _modulationsLen, pollNr, pollPeriod, &nt); if (res < 0) { throw NFCError("NFC polling error");