From e11b8aaabf64808457085752a288c5a2e37c4837 Mon Sep 17 00:00:00 2001 From: Ondrej Mikle Date: Sat, 19 Jul 2014 17:00:10 +0200 Subject: [PATCH] Check if device is opened before scanning --- brmdoor_nfc.cpp | 4 ++++ 1 file changed, 4 insertions(+) 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");