NFC: fix crash on MFC read (#1993)

* nfc: fix nfc_worker_stop logic
* nfc: fix stop order

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
gornekich 2022-11-09 22:12:55 +04:00 committed by GitHub
parent c89e5e11a4
commit 3985b456c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View File

@ -70,13 +70,13 @@ void nfc_worker_start(
void nfc_worker_stop(NfcWorker* nfc_worker) {
furi_assert(nfc_worker);
if(nfc_worker->state == NfcWorkerStateBroken || nfc_worker->state == NfcWorkerStateReady) {
return;
}
furi_assert(nfc_worker->thread);
if(furi_thread_get_state(nfc_worker->thread) != FuriThreadStateStopped) {
furi_hal_nfc_stop();
nfc_worker_change_state(nfc_worker, NfcWorkerStateStop);
furi_thread_join(nfc_worker->thread);
}
}
void nfc_worker_change_state(NfcWorker* nfc_worker, NfcWorkerState state) {
nfc_worker->state = state;

View File

@ -7,7 +7,6 @@ typedef struct NfcWorker NfcWorker;
typedef enum {
// Init states
NfcWorkerStateNone,
NfcWorkerStateBroken,
NfcWorkerStateReady,
// Main worker states
NfcWorkerStateRead,