From 033ce3051b4abd06318d9b8234775c29ff325695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?= Date: Tue, 16 Feb 2021 01:41:02 +0800 Subject: [PATCH] filter desctiption existance before passing it to distinct --- Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs index 372d36524..8657f0ec0 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs @@ -475,9 +475,10 @@ namespace Flow.Launcher.Plugin.Program.Programs return programs.GroupBy(p => p.FullPath.ToLower()) .SelectMany(g => { - if (g.Count() > 1) - return DistinctBy(g.Where(p => !string.IsNullOrEmpty(p.Description)), x => x.Description); - return g; + var temp = g.Where(g => !string.IsNullOrEmpty(g.Description)).ToList(); + if (temp.Any()) + return DistinctBy(temp, x => x.Description); + return g.Take(1); }).ToArray(); }