Skip to content

Commit

Permalink
Null checks for comma-separated lists
Browse files Browse the repository at this point in the history
  • Loading branch information
Deadpikle committed Nov 22, 2023
1 parent 04141da commit 608bf0b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/NetSparkle.Tools.AppCastGenerator/AppCastMaker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ public string GetPathToAppCastOutput(string desiredOutputDirectory, string sourc
public (List<AppCastItem>, string) LoadAppCastItemsAndProductName(string sourceBinaryDirectory, bool useExistingAppCastItems, string outputAppCastFileName)
{
var items = new List<AppCastItem>();
var dirFileSearches = GetSearchExtensionsFromString(_opts.Extensions);
var dirFileSearches = GetSearchExtensionsFromString(_opts.Extensions ?? "");
var binaries = FindBinaries(sourceBinaryDirectory, dirFileSearches, _opts.SearchBinarySubDirectories);
if (!binaries.Any())
{
Expand Down Expand Up @@ -382,14 +382,17 @@ public string GetPathToAppCastOutput(string desiredOutputDirectory, string sourc
items.Sort((a, b) => b.Version.CompareTo(a.Version));

// mark critical items as critical
var criticalVersions = _opts.CriticalVersions.Split(",").ToList()
var criticalVersions = _opts.CriticalVersions?.Split(",").ToList()
.Where(x => !string.IsNullOrWhiteSpace(x))
.Distinct();
foreach (var item in items)
if (criticalVersions != null)
{
if (criticalVersions.Contains(item.Version))
foreach (var item in items)
{
item.IsCriticalUpdate = true;
if (criticalVersions.Contains(item.Version))
{
item.IsCriticalUpdate = true;
}
}
}

Expand Down

0 comments on commit 608bf0b

Please sign in to comment.