From ae302a8414cbd18166d6261a6c818c61a9a663ad Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 30 May 2008 01:03:32 +0200 Subject: [PATCH] return null is base path is not a directory --- src/net/pterodactylus/jsite/project/Project.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/net/pterodactylus/jsite/project/Project.java b/src/net/pterodactylus/jsite/project/Project.java index f6314cb..4d778ab 100644 --- a/src/net/pterodactylus/jsite/project/Project.java +++ b/src/net/pterodactylus/jsite/project/Project.java @@ -281,11 +281,16 @@ public class Project extends AbstractBean { * path. This method is disk-intensive and may take some time on larger * directories! * - * @return The file for the base path + * @return The file for the base path, or null if the base + * path does not denote an existing directory */ public ProjectFile getBaseFile() { + File basePathFile = new File(basePath); + if (!basePathFile.exists() || !basePathFile.isDirectory()) { + return null; + } ProjectFileImpl rootProjectFile = new ProjectFileImpl(null, "", true, false); - scanDirectory(new File(basePath), rootProjectFile); + scanDirectory(basePathFile, rootProjectFile); return rootProjectFile; } -- 2.7.4