From be90b4e0ca65bf7d7c3070bc560c6862dd5ad33f Mon Sep 17 00:00:00 2001 From: Todd Naugle Date: Tue, 10 May 2022 09:16:58 -0500 Subject: [PATCH] US2400 - fix crash when no strip is selected first selected could be null, so check that first. This is untested since I don't have a surface. --- libs/surfaces/us2400/mcp_buttons.cc | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/libs/surfaces/us2400/mcp_buttons.cc b/libs/surfaces/us2400/mcp_buttons.cc index 9f1b820154..45ba42137e 100644 --- a/libs/surfaces/us2400/mcp_buttons.cc +++ b/libs/surfaces/us2400/mcp_buttons.cc @@ -130,18 +130,22 @@ LedState US2400Protocol::right_press (Button &) { if (_subview_mode != None) { - bool hasNextSend = true; - int numSends = 0; - while (hasNextSend) { - if (first_selected_stripable()->send_name(numSends).length() < 1) { - hasNextSend = false; - } else { - numSends++; + boost::shared_ptr s = first_selected_stripable(); + + if (s) { + bool hasNextSend = true; + int numSends = 0; + while (hasNextSend) { + if (s->send_name(numSends).length() < 1) { + hasNextSend = false; + } else { + numSends++; + } + } + if (numSends > (_sends_bank + 1) * 16) { + _sends_bank++; + redisplay_subview_mode(); } - } - if (numSends > (_sends_bank + 1) * 16) { - _sends_bank++; - redisplay_subview_mode(); } return none; }