Check if device is opened before scanning

This commit is contained in:
Ondrej Mikle 2014-07-19 17:00:10 +02:00
parent 7de37d5822
commit e11b8aaabf

View file

@ -65,6 +65,10 @@ std::string NFCDevice::scanUID() throw(NFCError)
int res; int res;
nfc_target nt; nfc_target nt;
if (!opened()) {
throw NFCError("NFC device not opened");
}
res = nfc_initiator_poll_target(_nfcDevice, _modulations, _modulationsLen, pollNr, pollPeriod, &nt); res = nfc_initiator_poll_target(_nfcDevice, _modulations, _modulationsLen, pollNr, pollPeriod, &nt);
if (res < 0) { if (res < 0) {
throw NFCError("NFC polling error"); throw NFCError("NFC polling error");