summaryrefslogtreecommitdiff
path: root/gtk2_ardour/plugin_selector.cc
diff options
context:
space:
mode:
authorJohn Emmas <johne53@tiscali.co.uk>2014-05-10 08:32:14 +0100
committerJohn Emmas <johne53@tiscali.co.uk>2014-05-10 08:32:14 +0100
commitb377bc44c2e7257ba0d52ca554398c05bc40198f (patch)
treed245e5934ff74dafc8ade5af385584716e79cbd4 /gtk2_ardour/plugin_selector.cc
parent349f66f41301d96935874a75329fa070029406e1 (diff)
Bug fix imported from Mixbus2 (SVN r11448)
If we couldn't figure out a plugin creator's name, either use as much of it as we could determine or mark the creator as 'Unknown'
Diffstat (limited to 'gtk2_ardour/plugin_selector.cc')
-rw-r--r--gtk2_ardour/plugin_selector.cc20
1 files changed, 17 insertions, 3 deletions
diff --git a/gtk2_ardour/plugin_selector.cc b/gtk2_ardour/plugin_selector.cc
index 252accd523..0c46a622b3 100644
--- a/gtk2_ardour/plugin_selector.cc
+++ b/gtk2_ardour/plugin_selector.cc
@@ -316,7 +316,12 @@ PluginSelector::refiller (const PluginInfoList& plugs, const::std::string& filte
#else
while (pos < creator.length() && (isalnum (creator[pos]) || isspace (creator[pos]))) ++pos;
#endif
- creator = creator.substr (0, pos);
+ // If there were too few characters to create a
+ // meaningfule name, mark this creator as 'Unknown'
+ if (creator.length()<2 || pos<3)
+ creator = "Unknown";
+ else
+ creator = creator.substr (0, pos);
newrow[plugin_columns.creator] = creator;
@@ -685,11 +690,20 @@ PluginSelector::create_by_creator_menu (ARDOUR::PluginInfoList& all_plugs)
/* stupid LADSPA creator strings */
string::size_type pos = 0;
#ifdef PLATFORM_WINDOWS
- while (pos < creator.length() && creator[pos] > -2 && creator[pos] < 256 && (isalnum (creator[pos]) || isspace (creator[pos]))) ++pos;
+ while (pos < creator.length() && creator[pos]>(-2) && creator[pos]<256 && (isprint (creator[pos]))) ++pos;
#else
while (pos < creator.length() && (isalnum (creator[pos]) || isspace (creator[pos]))) ++pos;
#endif
- creator = creator.substr (0, pos);
+
+ // Check to see if we found any invalid characters.
+ if (creator.length() != pos) {
+ // If there were too few characters to create a
+ // meaningfule name, mark this creator as 'Unknown'
+ if (pos<3)
+ creator = "Unknown?";
+ else
+ creator = creator.substr (0, pos);
+ }
SubmenuMap::iterator x;
Gtk::Menu* submenu;