diff --git a/QuickLook/NativeMethods/WMI.cs b/QuickLook/NativeMethods/WMI.cs index a88ee52..e306100 100644 --- a/QuickLook/NativeMethods/WMI.cs +++ b/QuickLook/NativeMethods/WMI.cs @@ -33,7 +33,8 @@ internal static class WMI List names = []; foreach (var obj in searcher.Get()) - names.Add(obj["Name"] as string); + if (obj["Name"] is string name) + names.Add(name); return names; } @@ -49,6 +50,7 @@ internal static class WMI { Debug.WriteLine($"General exception caught: {e.Message}"); } + return []; } -} +} \ No newline at end of file