From e3b5a9bde4c3845aae2b277e5ac806bc749bb5c7 Mon Sep 17 00:00:00 2001 From: Victoria Fischer Date: Sat, 16 Nov 2024 12:15:42 +0100 Subject: [PATCH] platform: smart_leds: handle frame render error --- src/platform/smart_leds_lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/platform/smart_leds_lib.rs b/src/platform/smart_leds_lib.rs index f6ca3ec..83a5e50 100644 --- a/src/platform/smart_leds_lib.rs +++ b/src/platform/smart_leds_lib.rs @@ -69,7 +69,9 @@ impl>, S: Surface, const PIXEL_NUM: usize> Dis fn end_frame(&mut self) { let b = brightness_for_mw(self.pixbuf.as_milliwatts(), 255, self.max_mw); - let _ = self.target.write(brightness(self.pixbuf.iter().cloned(), b)); + if let Err(_) = self.target.write(brightness(self.pixbuf.iter().cloned(), b).map(|x| { rgb::Bgr::new(x.r, x.g, x.b)})) { + panic!("Could not write frame"); + } } fn render_frame(&mut self) {