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 | |
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
-rw-r--r-- | libs/surfaces/launch_control_xl/controllers.cc | 27 | ||||
-rw-r--r-- | libs/surfaces/launch_control_xl/launch_control_xl.cc | 4 |
2 files changed, 18 insertions, 13 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()); } diff --git a/libs/surfaces/launch_control_xl/launch_control_xl.cc b/libs/surfaces/launch_control_xl/launch_control_xl.cc index 2dfa2418d5..eaa125df82 100644 --- a/libs/surfaces/launch_control_xl/launch_control_xl.cc +++ b/libs/surfaces/launch_control_xl/launch_control_xl.cc @@ -899,7 +899,9 @@ LaunchControlXL::switch_bank (uint32_t base) stripable[n]->presentation_info().PropertyChanged.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::stripable_property_change, this, _1, n), lcxl); stripable[n]->solo_control()->Changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::solo_changed, this, n), lcxl); stripable[n]->mute_control()->Changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::mute_changed, this, n), lcxl); - stripable[n]->solo_isolate_control()->Changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::solo_iso_changed, this,n ), lcxl); + if (stripable[n]->solo_isolate_control()) { /*VCAs are stripables without isolate solo */ + stripable[n]->solo_isolate_control()->Changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::solo_iso_changed, this,n ), lcxl); + } #ifdef MIXBUS if (stripable[n]->master_send_enable_controllable()) { stripable[n]->master_send_enable_controllable()->Changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::master_send_changed, this,n ), lcxl); |