Skip to content

Commit d8b1037

Browse files
committed
Update NBGL spinner
1 parent c476847 commit d8b1037

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

ledger_device_sdk/src/nbgl/nbgl_spinner.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ use alloc::ffi::CString;
77
/// 800 ms, provided the IO event loop is running to process TickerEvents.
88
#[derive(Debug, Default)]
99
pub struct NbglSpinner {
10-
text: [Option<CString>; 2],
10+
text: [CString; 2],
1111
write_idx: usize,
1212
read_idx: usize,
1313
}
1414

1515
impl NbglSpinner {
1616
pub fn new() -> NbglSpinner {
1717
NbglSpinner {
18-
text: [None, None],
18+
text: [CString::default(), CString::default()],
1919
write_idx: 0,
2020
read_idx: 0,
2121
}
@@ -24,13 +24,11 @@ impl NbglSpinner {
2424
/// Shows the spinner with the current text.
2525
/// Every call make the spinner "turn" to the next text.
2626
pub fn show(&mut self, text: &str) {
27-
self.text[self.write_idx] = Some(CString::new(text).unwrap());
27+
self.text[self.write_idx] = CString::new(text).unwrap();
2828
self.read_idx = self.write_idx;
2929
self.write_idx = (self.write_idx + 1) % 2;
3030
unsafe {
31-
nbgl_useCaseSpinner(
32-
self.text[self.read_idx].as_ref().unwrap().as_ptr() as *const c_char
33-
);
31+
nbgl_useCaseSpinner(self.text[self.read_idx].as_ptr() as *const c_char);
3432
}
3533
}
3634
}

0 commit comments

Comments
 (0)