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:
parent
c89e5e11a4
commit
3985b456c3
@ -70,12 +70,12 @@ 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);
|
||||
}
|
||||
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) {
|
||||
|
@ -7,7 +7,6 @@ typedef struct NfcWorker NfcWorker;
|
||||
typedef enum {
|
||||
// Init states
|
||||
NfcWorkerStateNone,
|
||||
NfcWorkerStateBroken,
|
||||
NfcWorkerStateReady,
|
||||
// Main worker states
|
||||
NfcWorkerStateRead,
|
||||
|
Loading…
Reference in New Issue
Block a user