Mercurial > hg > vamp-plugin-sdk
comparison src/vamp-hostsdk/PluginHostAdapter.cpp @ 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 | d5c5a52e6c9f |
children | dc40fff9f20b |
comparison
equal
deleted
inserted
replaced
344:f937ac344270 | 345:079209375f07 |
---|---|
263 PluginHostAdapter::getCurrentProgram() const | 263 PluginHostAdapter::getCurrentProgram() const |
264 { | 264 { |
265 if (!m_handle) return ""; | 265 if (!m_handle) return ""; |
266 | 266 |
267 int pn = m_descriptor->getCurrentProgram(m_handle); | 267 int pn = m_descriptor->getCurrentProgram(m_handle); |
268 return m_descriptor->programs[pn]; | 268 if (pn < (int)m_descriptor->programCount) { |
269 return m_descriptor->programs[pn]; | |
270 } else { | |
271 return ""; | |
272 } | |
269 } | 273 } |
270 | 274 |
271 void | 275 void |
272 PluginHostAdapter::selectProgram(std::string program) | 276 PluginHostAdapter::selectProgram(std::string program) |
273 { | 277 { |