From 9d1f316ea3daaa3de5eef8c19cf2dab4e78d1ef8 Mon Sep 17 00:00:00 2001 From: Robin Davies Date: Mon, 19 Aug 2024 15:15:30 -0400 Subject: [PATCH] Defensive coding for plugin filtering. --- react/src/LoadPluginDialog.tsx | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/react/src/LoadPluginDialog.tsx b/react/src/LoadPluginDialog.tsx index fea41e4..109c2f4 100644 --- a/react/src/LoadPluginDialog.tsx +++ b/react/src/LoadPluginDialog.tsx @@ -500,20 +500,25 @@ export const LoadPluginDialog = for (let i = 0; i < plugins.length; ++i) { let plugin = plugins[i]; - if (filterType === PluginType.Plugin || rootClass.is_type_of(filterType, plugin.plugin_type)) { - let score: number = 0; - if (plugin.is_vst3) { - score = searchFilter.score(plugin.name, plugin.plugin_display_type, plugin.author_name, "vst3"); - } else { - score = searchFilter.score(plugin.name, plugin.plugin_display_type, plugin.author_name); - } - - if (score !== 0) { - if (favoritesList[plugin.uri]) { - score += 32768; + try { + if (filterType === PluginType.Plugin || rootClass.is_type_of(filterType, plugin.plugin_type)) { + let score: number = 0; + if (plugin.is_vst3) { + score = searchFilter.score(plugin.name, plugin.plugin_display_type, plugin.author_name, "vst3"); + } else { + score = searchFilter.score(plugin.name, plugin.plugin_display_type, plugin.author_name); + } + + if (score !== 0) { + 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 }) => {