Skip to content

Commit

Permalink
fix: panic on connect to input
Browse files Browse the repository at this point in the history
Upon inspection, it appears the received message will continuously send a single byte `11110000` when no keys are pressed. The length of this value is 1 byte. Not sure what this means or how MIDI works, but checking that
the input length is equal to 3 fixes this problem.
  • Loading branch information
dsgallups committed Dec 6, 2024
1 parent 6b46b89 commit 50edc17
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ impl Future for MidiInputTask {
&port,
self.settings.port_name,
move |stamp, message, _| {
if message.len() != 3 {
return;
}
let _ = s.send(Reply::Midi(MidiData {
stamp,
message: [message[0], message[1], message[2]].into(),
Expand Down

0 comments on commit 50edc17

Please sign in to comment.