Skip to content

Commit 79db49d

Browse files
committed
fix(effects): Prevent crashes on ripple
Caused by an oversight when updating to version 3 of device_query in 0.20.3. DeviceEventHandler returns None once it's inner event loop has been initialised already, leading the unwrap() to fail. Fixes #207
1 parent cc9c127 commit 79db49d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/src/manager/effects/ripple.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ pub fn play(manager: &mut Inner, p: &Profile) {
3838
let (tx, rx) = crossbeam_channel::unbounded::<Event>();
3939

4040
thread::spawn(move || {
41-
let event_handler = DeviceEventsHandler::new(Duration::from_millis(10)).unwrap();
41+
// Do this in order to avoid having to store the event handler struct somewhere,
42+
// since it saves no data and serves only as a fancy function proxy for interacting with the real event loop
43+
// This keeps the effect self contained, and other effects should probably use the same pattern
44+
let event_handler = DeviceEventsHandler::new(Duration::from_millis(10)).unwrap_or(DeviceEventsHandler {});
4245

4346
// tx_clone.send(Event::KeyPress(Keycode::Meta)).unwrap();
4447
let tx_clone = tx.clone();

0 commit comments

Comments
 (0)