Mercurial > hg > vamp-plugin-sdk
changeset 345:079209375f07
Avoid returning garbage through getCurrentProgram if plugin has no programs
author | Chris Cannam |
---|---|
date | Sun, 06 Jan 2013 20:45:55 +0000 |
parents | f937ac344270 |
children | bb8f437bf09f |
files | src/vamp-hostsdk/PluginHostAdapter.cpp |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/vamp-hostsdk/PluginHostAdapter.cpp Thu Jul 12 14:59:40 2012 +0100 +++ b/src/vamp-hostsdk/PluginHostAdapter.cpp Sun Jan 06 20:45:55 2013 +0000 @@ -265,7 +265,11 @@ if (!m_handle) return ""; int pn = m_descriptor->getCurrentProgram(m_handle); - return m_descriptor->programs[pn]; + if (pn < (int)m_descriptor->programCount) { + return m_descriptor->programs[pn]; + } else { + return ""; + } } void