Merge pull request #3184 from silverwolfg11/path-null-check
Null check for path environment variable.
This commit is contained in:
commit
e879ed7e41
1 changed files with 6 additions and 1 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue