From 3f0130f8ead44fe6576a33bbe6b3b52156a15248 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 31 Oct 2016 00:35:53 +0100 Subject: [PATCH] Fix crash when instrument instantiation fails on track creation. --- libs/ardour/session.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 5605ac1e6c..51bef1202b 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -2530,12 +2530,15 @@ Session::new_midi_track (const ChanCount& input, const ChanCount& output, if (instrument) { for (RouteList::iterator r = new_routes.begin(); r != new_routes.end(); ++r) { PluginPtr plugin = instrument->load (*this); + if (!plugin) { + warning << "Failed to add Synth Plugin to newly created track." << endmsg; + continue; + } if (pset) { plugin->load_preset (*pset); } boost::shared_ptr p (new PluginInsert (*this, plugin)); (*r)->add_processor (p, PreFader); - } } } @@ -2618,6 +2621,10 @@ Session::new_midi_route (RouteGroup* route_group, uint32_t how_many, string name if (instrument) { for (RouteList::iterator r = ret.begin(); r != ret.end(); ++r) { PluginPtr plugin = instrument->load (*this); + if (!plugin) { + warning << "Failed to add Synth Plugin to newly created track." << endmsg; + continue; + } if (pset) { plugin->load_preset (*pset); }