Skip to content

Commit 7f586b3

Browse files
make name not null
1 parent 5c62c5a commit 7f586b3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Plugins/Flow.Launcher.Plugin.Program/Views/Models/ProgramSource.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace Flow.Launcher.Plugin.Program.Views.Models
1515
/// </remarks>
1616
public class ProgramSource
1717
{
18-
private string name;
18+
private string name = string.Empty;
1919
private string loc = string.Empty;
2020
private string uniqueIdentifier = string.Empty;
2121

@@ -29,7 +29,7 @@ public string Location
2929
}
3030
}
3131

32-
public string Name { get => name ?? new DirectoryInfo(Location).Name; set => name = value; }
32+
public string Name { get => name ; set => name = value ?? string.Empty; }
3333
public bool Enabled { get; set; } = true;
3434

3535
public string UniqueIdentifier { get => uniqueIdentifier;
@@ -43,7 +43,7 @@ private set
4343
public ProgramSource(string name, string location, bool enabled, string uniqueIdentifier)
4444
{
4545
loc = location ?? string.Empty;
46-
this.name = name;
46+
Name = name;
4747
Enabled = enabled;
4848
UniqueIdentifier = uniqueIdentifier;
4949
}
@@ -58,11 +58,12 @@ public ProgramSource(string location, bool enabled = true)
5858
loc = location ?? string.Empty;
5959
Enabled = enabled;
6060
UniqueIdentifier = location; // For path comparison
61+
Name = new DirectoryInfo(Location).Name;
6162
}
6263

6364
public ProgramSource(IProgram source)
6465
{
65-
loc = source.Location;
66+
loc = source.Location ?? string.Empty;
6667
Name = source.Name;
6768
Enabled = source.Enabled;
6869
UniqueIdentifier = source.UniqueIdentifier;

0 commit comments

Comments
 (0)