Defensive coding for plugin filtering.

This commit is contained in:
Robin Davies
2024-08-19 15:15:30 -04:00
parent b06c16f9f1
commit 9d1f316ea3
+17 -12
View File
@@ -500,20 +500,25 @@ export const LoadPluginDialog =
for (let i = 0; i < plugins.length; ++i) { for (let i = 0; i < plugins.length; ++i) {
let plugin = plugins[i]; let plugin = plugins[i];
if (filterType === PluginType.Plugin || rootClass.is_type_of(filterType, plugin.plugin_type)) { try {
let score: number = 0; if (filterType === PluginType.Plugin || rootClass.is_type_of(filterType, plugin.plugin_type)) {
if (plugin.is_vst3) { let score: number = 0;
score = searchFilter.score(plugin.name, plugin.plugin_display_type, plugin.author_name, "vst3"); if (plugin.is_vst3) {
} else { score = searchFilter.score(plugin.name, plugin.plugin_display_type, plugin.author_name, "vst3");
score = searchFilter.score(plugin.name, plugin.plugin_display_type, plugin.author_name); } else {
} score = searchFilter.score(plugin.name, plugin.plugin_display_type, plugin.author_name);
}
if (score !== 0) {
if (favoritesList[plugin.uri]) { if (score !== 0) {
score += 32768; if (favoritesList[plugin.uri]) {
score += 32768;
}
results.push({ score: score, plugin: plugin });
} }
results.push({ score: score, plugin: plugin });
} }
} catch (e)
{
alert("Bad plugin:" + (plugin?.name??"null") + " plugin type: " + (plugin?.plugin_type??"null"));
} }
} }
results.sort((left: { score: number; plugin: UiPlugin }, right: { score: number; plugin: UiPlugin }) => { results.sort((left: { score: number; plugin: UiPlugin }, right: { score: number; plugin: UiPlugin }) => {