OSC: Fix potential crash on select-prev-route (#8670)

If the selection here is empty for whatever reason, it crashed with a null
pointer dereference.
This commit is contained in:
David Robillard 2021-06-18 12:55:45 -04:00
parent 45bd2c47d8
commit 57a3db06f8
1 changed files with 3 additions and 1 deletions

View File

@ -79,7 +79,9 @@ CoreSelection::select_adjacent_stripable (bool mixer_order, bool routes_only,
/* fetch the current selection so that we can get the most recently selected */
StripableAutomationControls selected;
get_stripables (selected);
boost::shared_ptr<Stripable> last_selected = selected.back().stripable;
boost::shared_ptr<Stripable> last_selected =
selected.empty () ? boost::shared_ptr<Stripable> ()
: selected.back ().stripable;
/* Get all stripables and sort into the appropriate ordering */
StripableList stripables;