From fbf00f4ea8f3e0e1d84e2554896a66fa656a39f3 Mon Sep 17 00:00:00 2001 From: Corniel Nobel Date: Sun, 17 Nov 2024 10:38:28 +0100 Subject: [PATCH] Check on HasValue.; --- src/Buildalyzer/AnalyzerManager.cs | 2 +- src/Buildalyzer/IO/IOPath.cs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Buildalyzer/AnalyzerManager.cs b/src/Buildalyzer/AnalyzerManager.cs index 7ca15db..c95008d 100644 --- a/src/Buildalyzer/AnalyzerManager.cs +++ b/src/Buildalyzer/AnalyzerManager.cs @@ -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); diff --git a/src/Buildalyzer/IO/IOPath.cs b/src/Buildalyzer/IO/IOPath.cs index 17d0572..81b5901 100644 --- a/src/Buildalyzer/IO/IOPath.cs +++ b/src/Buildalyzer/IO/IOPath.cs @@ -23,6 +23,9 @@ namespace Buildalyzer.IO; private IOPath(string path) => _path = path; + /// Returns true if the path is not empty. + public bool HasValue => _path is { Length: > 0 }; + /// Creates a based on the path. [Pure] public DirectoryInfo Directory() => new(ToString());