13
0

Slightly tweaked patch from colinf to avoid crashes on

out-of-range LADSPA port indices (#4700).


git-svn-id: svn://localhost/ardour2/branches/3.0@11528 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2012-02-27 15:21:29 +00:00
parent bd2e28aaac
commit af7494ceb2
2 changed files with 14 additions and 1 deletions

View File

@ -113,7 +113,7 @@ class LadspaPlugin : public ARDOUR::Plugin
LADSPA_Properties properties() const { return _descriptor->Properties; }
uint32_t index() const { return _index; }
const char * copyright() const { return _descriptor->Copyright; }
LADSPA_PortDescriptor port_descriptor(uint32_t i) const { return _descriptor->PortDescriptors[i]; }
LADSPA_PortDescriptor port_descriptor(uint32_t i) const;
const LADSPA_PortRangeHint* port_range_hints() const { return _descriptor->PortRangeHints; }
const char * const * port_names() const { return _descriptor->PortNames; }

View File

@ -916,3 +916,16 @@ LadspaPlugin::do_save_preset (string name)
return uri;
}
LADSPA_PortDescriptor
LadspaPlugin::port_descriptor (uint32_t i) const
{
if (i < _descriptor->PortCount) {
return _descriptor->PortDescriptors[i];
}
warning << "LADSPA plugin port index " << i << " out of range." << endmsg;
return 0;
}