terminal: remove unwrap() from get_events() loop
When exiting the app, the received value might be None. Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>pull/386/head
parent
46e40856ba
commit
b5ddc397df
|
@ -215,9 +215,10 @@ enum InputMode {
|
|||
Paste(Vec<u8>),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Default)]
|
||||
/// Main process sends commands to the input thread.
|
||||
pub enum InputCommand {
|
||||
#[default]
|
||||
/// Exit thread
|
||||
Kill,
|
||||
}
|
||||
|
@ -303,7 +304,7 @@ pub fn get_events(
|
|||
continue 'poll_while;
|
||||
};
|
||||
let _ = nix::unistd::read(new_command_fd.as_raw_fd(), buf.as_mut());
|
||||
match cmd.unwrap() {
|
||||
match cmd.unwrap_or_default() {
|
||||
InputCommand::Kill => return,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue