From 41d91e7527f07f0e8df5a1de7aad0b8958452e58 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 5 Nov 2025 18:08:45 -0700 Subject: [PATCH] prevent crash in MIDI triggers when transport op is invoked on an inactive track --- libs/ardour/triggerbox.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/libs/ardour/triggerbox.cc b/libs/ardour/triggerbox.cc index a09a527cab..e7c527b124 100644 --- a/libs/ardour/triggerbox.cc +++ b/libs/ardour/triggerbox.cc @@ -3148,7 +3148,21 @@ MIDITrigger::midi_run (BufferSet& bufs, samplepos_t start_sample, samplepos_t en Temporal::Beats const & start_beats, Temporal::Beats const & end_beats, pframes_t nframes, pframes_t dest_offset, double bpm, pframes_t& quantize_offset) { - assert (rt_midibuffer); + /* We can get here if our Triggerbox is in an inactive track, and some + transport operations (load, stop) are called. That's OK, but the + route must be inactive. A null rt_midibuffer value in any condition + is a coding error. + */ + + if (!rt_midibuffer) { + Route* rt = static_cast (box().owner()); + + if (!rt || !rt->active()) { + return nframes; + } + + assert (false); + } MidiBuffer* mb (in_process_context? &bufs.get_midi (0) : nullptr); typedef Evoral::Event MidiEvent;