summaryrefslogtreecommitdiff
path: root/gtk2_ardour/step_editor.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-08-20 04:38:59 +0200
committerRobin Gareus <robin@gareus.org>2019-08-20 04:46:42 +0200
commit0972e9a513abaff87d24880691f22fc9505060c6 (patch)
tree37c685e5f464db9ce77d692dc45536e87d8722bd /gtk2_ardour/step_editor.cc
parent114b5088c76f2a0d9aecc3beafd993b0cb916ae2 (diff)
Skip potential garbage midi-step
Diffstat (limited to 'gtk2_ardour/step_editor.cc')
-rw-r--r--gtk2_ardour/step_editor.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/gtk2_ardour/step_editor.cc b/gtk2_ardour/step_editor.cc
index dcb5376003..e2b230de27 100644
--- a/gtk2_ardour/step_editor.cc
+++ b/gtk2_ardour/step_editor.cc
@@ -193,7 +193,9 @@ StepEditor::check_step_edit ()
Evoral::EventType type;
uint32_t size;
- incoming.read_prefix (&time, &type, &size);
+ if (!incoming.read_prefix (&time, &type, &size)) {
+ break;
+ }
if (size > bufsize) {
delete [] buf;
@@ -201,9 +203,11 @@ StepEditor::check_step_edit ()
buf = new uint8_t[bufsize];
}
- incoming.read_contents (size, buf);
+ if (!incoming.read_contents (size, buf)) {
+ break;
+ }
- if ((buf[0] & 0xf0) == MIDI_CMD_NOTE_ON) {
+ if ((buf[0] & 0xf0) == MIDI_CMD_NOTE_ON && size == 3) {
step_add_note (buf[0] & 0xf, buf[1], buf[2], Temporal::Beats());
}
}