summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorLen Ovens <len@ovenwerks.net>2016-01-16 11:17:52 -0800
committerLen Ovens <len@ovenwerks.net>2016-01-16 11:17:52 -0800
commit23041fda88284c35a926ab0c8baa6ea53dccedef (patch)
tree8f0fd291dca590f59bd84662483430debf808ef2 /libs
parent92dba5bfa3870b56c1ddd9211abe82b16a1206a1 (diff)
Mackie Control: fix math error that tried to change bank to very high number
Diffstat (limited to 'libs')
-rw-r--r--libs/surfaces/mackie/mackie_control_protocol.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc
index 97f96157d0..2580fa9672 100644
--- a/libs/surfaces/mackie/mackie_control_protocol.cc
+++ b/libs/surfaces/mackie/mackie_control_protocol.cc
@@ -1301,7 +1301,11 @@ MackieControlProtocol::notify_remote_id_changed()
if (sorted.size() - _current_initial_bank < sz) {
// but don't shift backwards past the zeroth channel
- switch_banks (max((Sorted::size_type) 0, sorted.size() - sz));
+ if (sorted.size() < sz) { // avoid unsigned math mistake below
+ switch_banks(0, true);
+ } else {
+ switch_banks (max((Sorted::size_type) 0, sorted.size() - sz), true);
+ }
} else {
// Otherwise just refresh the current bank
refresh_current_bank();