diff --git a/Rubjerg.Graphviz/GraphvizCommand.cs b/Rubjerg.Graphviz/GraphvizCommand.cs index ea04e92..022005b 100644 --- a/Rubjerg.Graphviz/GraphvizCommand.cs +++ b/Rubjerg.Graphviz/GraphvizCommand.cs @@ -43,8 +43,8 @@ internal static string Rid Path.GetDirectoryName(AppContext.BaseDirectory), "" ]; - return possibleLocations.Select(dir => Path.Combine(dir, "dot")).FirstOrDefault(File.Exists) - ?? possibleLocations.Select(dir => Path.Combine(dir, "dot.exe")).FirstOrDefault(File.Exists) + return possibleLocations.Where(d => d != null).Select(dir => Path.Combine(dir, "dot")).FirstOrDefault(File.Exists) + ?? possibleLocations.Where(d => d != null).Select(dir => Path.Combine(dir, "dot.exe")).FirstOrDefault(File.Exists) ?? throw new InvalidOperationException("Could not find path to dot binary in any of: " + string.Join(", ", possibleLocations)); }); internal static string DotExePath => _DotExePath.Value; @@ -129,3 +129,4 @@ public static (byte[] stdout, string stderr) Exec(Graph input, string format = " } } } +