Skip to content

Commit

Permalink
Fix empty reset code after type conversion error
Browse files Browse the repository at this point in the history
  • Loading branch information
sosthene-nitrokey committed Oct 10, 2022
1 parent a595016 commit b9f850a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ impl Internal {
value: &[u8],
password: Password,
) -> Result<(), Error> {
let new_pin = Bytes::from_slice(value).map_err(|_| Error::RequestTooLarge)?;
let (pin, tries) = match password {
Password::Pw1 => (&mut self.user_pin, &mut self.user_pin_tries),
Password::Pw3 => (&mut self.admin_pin, &mut self.admin_pin_tries),
Expand All @@ -471,7 +472,7 @@ impl Internal {
)
}
};
*pin = Bytes::from_slice(value).map_err(|_| Error::RequestTooLarge)?;
*pin = new_pin;
*tries = 0;
self.save(client)
}
Expand Down

0 comments on commit b9f850a

Please sign in to comment.