diff options
author | Jan Lentfer <jan.lentfer@web.de> | 2018-08-26 17:58:05 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2018-08-29 23:40:26 +0200 |
commit | c3d0c80f68870d2c3a7d48f1052fa26433ef338d (patch) | |
tree | fe2506679e2db7fccd4be48395f188c9e877e975 /libs/surfaces/launch_control_xl/controllers.cc | |
parent | 4111f66b25ee75ba9560b65b99da7f2bd83c8abe (diff) |
LCXL: Fix two crashes
* fix a crash when accessing VCAs
* fix a crash when being at the end
of available stripables
* unify for-loop constructs
Diffstat (limited to 'libs/surfaces/launch_control_xl/controllers.cc')
-rw-r--r-- | libs/surfaces/launch_control_xl/controllers.cc | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/libs/surfaces/launch_control_xl/controllers.cc b/libs/surfaces/launch_control_xl/controllers.cc index 1e33a5ac29..6621a15352 100644 --- a/libs/surfaces/launch_control_xl/controllers.cc +++ b/libs/surfaces/launch_control_xl/controllers.cc @@ -503,15 +503,16 @@ LaunchControlXL::solo_iso_led_bank () if (!(buttons_down.find(Device) != buttons_down.end())) { return; } else { - for (int y = 0; y < stripable_counter; ++y) { - TrackButton* b = focus_button_by_column(y); - - if (stripable[y]->solo_isolate_control()->get_value()) { - b->set_color(RedFull); - } else { - b->set_color(Off); + for (int n = 0; n < stripable_counter; ++n) { + TrackButton* b = focus_button_by_column(n); + if (stripable[n] && stripable[n]->solo_isolate_control()) { + if (stripable[n]->solo_isolate_control()->get_value()) { + b->set_color(RedFull); + } else { + b->set_color(Off); + } + write (b->state_msg()); } - write (b->state_msg()); } LaunchControlXL::set_refresh_leds_flag(true); } @@ -539,10 +540,12 @@ LaunchControlXL::master_send_led_bank () for (int n = 0; n < stripable_counter; ++n) { TrackButton* b = control_button_by_column(n); - if (stripable[n]->master_send_enable_controllable()->get_value()) { - b->set_color(GreenFull); - } else { - b->set_color(Off); + if (stripable[n] && stripable[n]->master_send_enable_controllable()) { + if (stripable[n]->master_send_enable_controllable()->get_value()) { + b->set_color(GreenFull); + } else { + b->set_color(Off); + } } write (b->state_msg()); } |