Prevent garbage preset names with VST plugins when the call to get preset name fails.
authorCarl Hetherington <carl@carlh.net>
Sat, 11 Dec 2010 02:35:31 +0000 (02:35 +0000)
committerCarl Hetherington <carl@carlh.net>
Sat, 11 Dec 2010 02:35:31 +0000 (02:35 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@8245 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/vst_plugin.cc

index 26b3ce78f60fbc55816c3ec678df1e3d20b6201d..e77fc483ed0fd2e6155c1718fe76f2c08622b8f7 100644 (file)
@@ -656,8 +656,11 @@ VSTPlugin::get_presets ()
                
                if (vst_version >= 2) {
                        char buf[256];
-                       _plugin->dispatcher (_plugin, 29, i, 0, buf, 0);
-                       r.label = buf;
+                       if (_plugin->dispatcher (_plugin, 29, i, 0, buf, 0) == 1) {
+                               r.label = buf;
+                       } else {
+                               r.label = string_compose (_("Preset %1"), i);
+                       }
                } else {
                        r.label = string_compose (_("Preset %1"), i);
                }