Skip to content

Commit c8d552f

Browse files
committed
Reading all executables in a directory crashed if directory doesn't exists
1 parent ed28bcb commit c8d552f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

GameLib.Core/Util/PathUtil.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ public static bool IsExecutable(string? path) =>
112112

113113
public static List<string> GetExecutables(string path)
114114
{
115-
return Directory.GetFiles(path, "*.exe", SearchOption.AllDirectories).ToList();
115+
if (Directory.Exists(path))
116+
return Directory.GetFiles(path, "*.exe", SearchOption.AllDirectories).ToList();
117+
118+
return new();
116119
}
117120
}

0 commit comments

Comments
 (0)