From 56ee21102e542120a56c4031241c96d29d8e279a Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 29 Jul 2024 17:46:30 -0400 Subject: [PATCH] Bound the lastPBByChannel in case called with channel -1 in a wildcard (#6) --- include/sst/voicemanager/managers/polymanager.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/sst/voicemanager/managers/polymanager.h b/include/sst/voicemanager/managers/polymanager.h index c9b1334..5666357 100644 --- a/include/sst/voicemanager/managers/polymanager.h +++ b/include/sst/voicemanager/managers/polymanager.h @@ -220,7 +220,9 @@ template struct PolyManager std::array lastPBByChannel{}; void routeMIDIPitchBend(int16_t port, int16_t channel, uint16_t pb14bit) { - lastPBByChannel[channel] = pb14bit - 8192; + if (channel >= 0 && channel < lastPBByChannel.size()) + lastPBByChannel[channel] = pb14bit - 8192; + for (auto &vi : voiceInfo) { if (vi.matches(port, channel, -1, -1)) // all keys and notes on a channel for midi PB