Firmware for HexBoard MIDI controller
Buzzer Tones: Don't do out-of-bounds array access
| -rw-r--r-- | HexBoard_V1.1.ino | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/HexBoard_V1.1.ino b/HexBoard_V1.1.ino index b0f31f3..55d83df 100644 --- a/HexBoard_V1.1.ino +++ b/HexBoard_V1.1.ino @@ -1162,6 +1162,10 @@ byte getHeldNote() { } void do_tone(byte pitch) { + if (pitch > 127 || pitch < 0) { + noTone(TONEPIN); + return; + } if (tones == 12) { tone(TONEPIN, pitches[pitch]); } else if (tones == 19) { |