Skip to content

Commit

Permalink
Implicit operators should not throw
Browse files Browse the repository at this point in the history
  • Loading branch information
jnm2 committed Feb 19, 2019
1 parent e991ba8 commit 020d6d3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Cake.Core/IO/DirectoryPath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public DirectoryPath Collapse()
/// <returns>A <see cref="DirectoryPath"/>.</returns>
public static implicit operator DirectoryPath(string path)
{
return FromString(path);
return path is null ? null : FromString(path);
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Cake.Core/IO/FilePath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public FilePath Collapse()
/// <returns>A <see cref="FilePath"/>.</returns>
public static implicit operator FilePath(string path)
{
return FromString(path);
return path is null ? null : FromString(path);
}

/// <summary>
Expand Down

0 comments on commit 020d6d3

Please sign in to comment.