From 4bb1c594acdf46a0a7a1687305f296ec7f5e7a58 Mon Sep 17 00:00:00 2001 From: Divam Date: Wed, 24 May 2023 11:20:43 +0900 Subject: [PATCH] Fix the logic; in case of error reset state. --- src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 89a23c8..fe76bd5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -543,7 +543,9 @@ pub fn poll_apdu_handlers<'a: 'b, 'b, F: Future, Ins, A: Fn(HostIO, Poll::Pending => { // Then, check that if we're waiting that we've actually given the host something to do. // In case of ResultFinal allow the Future to run to completion, and reset the state. - if io.0.borrow().sent_command != Some(LedgerToHostCmd::ResultFinal) { + if io.0.borrow().sent_command.is_some() + && io.0.borrow().sent_command != Some(LedgerToHostCmd::ResultFinal) + { return Ok(()); } else { error!("APDU handler future neither completed nor sent a command; something is probably missing an .await");