From fe1f8effb94b0ba25cc99c9d65f1e1f3d49dffd8 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 30 May 2020 05:20:21 +0200 Subject: [PATCH] Don't crash if ardour vamp plugins are n/a #8161 This still assert()s in debug builds. Since those plugins should always be available. --- libs/audiographer/src/general/loudness_reader.cc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/libs/audiographer/src/general/loudness_reader.cc b/libs/audiographer/src/general/loudness_reader.cc index 351b15f483..6e9facb6ca 100644 --- a/libs/audiographer/src/general/loudness_reader.cc +++ b/libs/audiographer/src/general/loudness_reader.cc @@ -38,11 +38,13 @@ LoudnessReader::LoudnessReader (float sample_rate, unsigned int channels, sample using namespace Vamp::HostExt; PluginLoader* loader (PluginLoader::getInstance ()); _ebur_plugin = loader->loadPlugin ("libardourvampplugins:ebur128", sample_rate, PluginLoader::ADAPT_ALL_SAFE); - assert (_ebur_plugin); - _ebur_plugin->reset (); - if (!_ebur_plugin->initialise (channels, _bufsize, _bufsize)) { - delete _ebur_plugin; - _ebur_plugin = 0; + assert (_ebur_plugin); // should always be available + if (_ebur_plugin) { + _ebur_plugin->reset (); + if (!_ebur_plugin->initialise (channels, _bufsize, _bufsize)) { + delete _ebur_plugin; + _ebur_plugin = 0; + } } } @@ -50,6 +52,10 @@ LoudnessReader::LoudnessReader (float sample_rate, unsigned int channels, sample using namespace Vamp::HostExt; PluginLoader* loader (PluginLoader::getInstance ()); Vamp::Plugin* dbtp_plugin = loader->loadPlugin ("libardourvampplugins:dBTP", sample_rate, PluginLoader::ADAPT_ALL_SAFE); + assert (dbtp_plugin); // should always be available + if (!dbtp_plugin) { + continue; + } dbtp_plugin->reset (); if (!dbtp_plugin->initialise (1, _bufsize, _bufsize)) { delete dbtp_plugin;