Skip to content

Commit

Permalink
Check on HasValue.;
Browse files Browse the repository at this point in the history
  • Loading branch information
Corniel committed Nov 17, 2024
1 parent 05a60a4 commit fbf00f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Buildalyzer/AnalyzerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public AnalyzerManager(string? solutionFilePath, AnalyzerManagerOptions? options

var path = IOPath.Parse(solutionFilePath);

if (path.File().Exists)
if (path.HasValue && path.File().Exists)
{
SolutionInfo = SolutionInfo.Load(path, Filter);

Expand Down
3 changes: 3 additions & 0 deletions src/Buildalyzer/IO/IOPath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ namespace Buildalyzer.IO;

private IOPath(string path) => _path = path;

/// <summary>Returns true if the path is not empty.</summary>
public bool HasValue => _path is { Length: > 0 };

/// <summary>Creates a <see cref="DirectoryInfo"/> based on the path.</summary>
[Pure]
public DirectoryInfo Directory() => new(ToString());
Expand Down

0 comments on commit fbf00f4

Please sign in to comment.