inputd: Don't crash when receiving input while there is no active vt

This commit is contained in:
bjorn3
2025-03-01 19:24:30 +01:00
parent d26ee5a58d
commit 2a71d48a76
+16 -15
View File
@@ -420,23 +420,24 @@ impl Scheme for InputScheme {
let handle = self.handles.get_mut(&id).ok_or(SysError::new(EINVAL))?;
assert!(handle.is_producer());
let active_vt = self.active_vt.unwrap();
for handle in self.handles.values_mut() {
match handle {
Handle::Consumer {
pending,
notified,
vt,
..
} => {
if *vt != active_vt {
continue;
}
if let Some(active_vt) = self.active_vt {
for handle in self.handles.values_mut() {
match handle {
Handle::Consumer {
pending,
notified,
vt,
..
} => {
if *vt != active_vt {
continue;
}
pending.extend_from_slice(buf);
*notified = false;
pending.extend_from_slice(buf);
*notified = false;
}
_ => continue,
}
_ => continue,
}
}