13
0

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.
This commit is contained in:
Todd Naugle 2022-05-10 09:16:58 -05:00
parent 834ca29cde
commit be90b4e0ca

View File

@ -130,18 +130,22 @@ LedState
US2400Protocol::right_press (Button &) US2400Protocol::right_press (Button &)
{ {
if (_subview_mode != None) { if (_subview_mode != None) {
bool hasNextSend = true; boost::shared_ptr<Stripable> s = first_selected_stripable();
int numSends = 0;
while (hasNextSend) { if (s) {
if (first_selected_stripable()->send_name(numSends).length() < 1) { bool hasNextSend = true;
hasNextSend = false; int numSends = 0;
} else { while (hasNextSend) {
numSends++; 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; return none;
} }