From 7f586b310655169c1470d32e3f01941dfc3f5f6f Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Tue, 15 Nov 2022 00:43:37 +0800 Subject: [PATCH] make name not null --- .../Views/Models/ProgramSource.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Views/Models/ProgramSource.cs b/Plugins/Flow.Launcher.Plugin.Program/Views/Models/ProgramSource.cs index e693aa471..945825f83 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Views/Models/ProgramSource.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Views/Models/ProgramSource.cs @@ -15,7 +15,7 @@ namespace Flow.Launcher.Plugin.Program.Views.Models /// public class ProgramSource { - private string name; + private string name = string.Empty; private string loc = string.Empty; private string uniqueIdentifier = string.Empty; @@ -29,7 +29,7 @@ namespace Flow.Launcher.Plugin.Program.Views.Models } } - public string Name { get => name ?? new DirectoryInfo(Location).Name; set => name = value; } + public string Name { get => name ; set => name = value ?? string.Empty; } public bool Enabled { get; set; } = true; public string UniqueIdentifier { get => uniqueIdentifier; @@ -43,7 +43,7 @@ namespace Flow.Launcher.Plugin.Program.Views.Models public ProgramSource(string name, string location, bool enabled, string uniqueIdentifier) { loc = location ?? string.Empty; - this.name = name; + Name = name; Enabled = enabled; UniqueIdentifier = uniqueIdentifier; } @@ -58,11 +58,12 @@ namespace Flow.Launcher.Plugin.Program.Views.Models loc = location ?? string.Empty; Enabled = enabled; UniqueIdentifier = location; // For path comparison + Name = new DirectoryInfo(Location).Name; } public ProgramSource(IProgram source) { - loc = source.Location; + loc = source.Location ?? string.Empty; Name = source.Name; Enabled = source.Enabled; UniqueIdentifier = source.UniqueIdentifier;