diff 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
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