Skip to content

3.0.3 - null error on combining paths (finding dot) #115

@modery

Description

@modery

I just updated my solution to the 3.0.3 version, and getting an error in line 46 of GraphVizCommand.cs. System.IO.Path.Combine fails because the first parameter is sometimes null.

The following code should fix this problem as it does some null filtering:

return possibleLocations.Where(d => !string.IsNullOrWhiteSpace(d)).Select(dir => Path.Combine(dir, "dot")).FirstOrDefault(File.Exists)
?? possibleLocations.Where(d => !string.IsNullOrWhiteSpace(d)).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));

Possible to get this reviewed, added, and a new package released?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions