From 253908a1f55f8d9a37346991daec42e943a9af6d Mon Sep 17 00:00:00 2001 From: ManlyMarco <39247311+ManlyMarco@users.noreply.github.com> Date: Wed, 18 Sep 2024 00:03:02 +0200 Subject: [PATCH] Harden against null plugin Metadata --- ConfigurationManager/SettingSearcher.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ConfigurationManager/SettingSearcher.cs b/ConfigurationManager/SettingSearcher.cs index 0de1314..6e06833 100644 --- a/ConfigurationManager/SettingSearcher.cs +++ b/ConfigurationManager/SettingSearcher.cs @@ -52,11 +52,12 @@ public static void CollectSettings(out IEnumerable results, ou var type = plugin.GetType(); var pluginInfo = plugin.Info.Metadata; + var pluginName = pluginInfo?.Name ?? plugin.GetType().FullName; if (type.GetCustomAttributes(typeof(BrowsableAttribute), false).Cast() - .Any(x => !x.Browsable)) + .Any(x => !x.Browsable)) { - modsWithoutSettings.Add(pluginInfo.Name); + modsWithoutSettings.Add(pluginName); continue; } @@ -67,7 +68,7 @@ public static void CollectSettings(out IEnumerable results, ou detected.RemoveAll(x => x.Browsable == false); if (detected.Count == 0) - modsWithoutSettings.Add(pluginInfo.Name); + modsWithoutSettings.Add(pluginName); // Allow to enable/disable plugin if it uses any update methods ------ if (showDebug && type.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).Any(x => _updateMethodNames.Contains(x.Name)))