don't crash on add track/scene

This commit is contained in:
🪞👃🪞 2024-07-12 14:46:20 +03:00
parent 5a9ec0a63d
commit 6a738375e2
9 changed files with 205 additions and 207 deletions

View file

@ -148,17 +148,12 @@ pub fn input_thread (
// Listen for events and send them to the main thread
if ::crossterm::event::poll(poll).is_ok() {
let event = ::crossterm::event::read().unwrap();
match event {
Event::Key(KeyEvent {
code: KeyCode::Char('c'),
modifiers: KeyModifiers::CONTROL,
..
}) => {
exited.store(true, Ordering::Relaxed);
},
_ => if device.write().unwrap().handle(&AppEvent::Input(event)).is_err() {
break
}
if let Event::Key(KeyEvent {
code: KeyCode::Char('c'), modifiers: KeyModifiers::CONTROL, ..
}) = event {
exited.store(true, Ordering::Relaxed);
} else if let Err(e) = device.write().unwrap().handle(&AppEvent::Input(event)) {
panic!("{e}")
}
}
})