Skip to content

Commit a032c16

Browse files
committed
Handle potential exception of GetFullPath
closes #9
1 parent 472e40a commit a032c16

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

FindExecutable/FindExecutable.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,15 @@ public static class FindExecutable
109109
continue;
110110
}
111111

112-
string p = Path.GetFullPath(path);
112+
string p;
113+
try
114+
{
115+
p = Path.GetFullPath(path);
116+
}
117+
catch
118+
{
119+
continue; // skip if `GetFullPath` failed, as then the string value of `path` was likely illegal
120+
}
113121
if (!Directory.Exists(p))
114122
{
115123
continue;

0 commit comments

Comments
 (0)