From 57a3db06f8ba346b60b521993a5b083fd5555da8 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 18 Jun 2021 12:55:45 -0400 Subject: [PATCH] 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. --- libs/ardour/selection.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/ardour/selection.cc b/libs/ardour/selection.cc index 3c4475872b..c75d578c4c 100644 --- a/libs/ardour/selection.cc +++ b/libs/ardour/selection.cc @@ -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 last_selected = selected.back().stripable; + boost::shared_ptr last_selected = + selected.empty () ? boost::shared_ptr () + : selected.back ().stripable; /* Get all stripables and sort into the appropriate ordering */ StripableList stripables;