Null check for path environment variable.

This commit is contained in:
Silverwolfg11 2020-11-14 23:21:06 -08:00
parent e962323e00
commit 87087a9c1e

View File

@ -438,7 +438,12 @@ public class DynmapCore implements DynmapCommonAPI {
}
private String findExecutableOnPath(String fname) {
for (String dirname : System.getenv("PATH").split(File.pathSeparator)) {
String path = System.getenv("PATH");
// Fast-fail if path is null.
if (path == null)
return null;
for (String dirname : path.split(File.pathSeparator)) {
File file = new File(dirname, fname);
if (file.isFile() && file.canExecute()) {
return file.getAbsolutePath();