hackage
[org.ibex.jinetd.git] / src / org / ibex / jinetd / Host.java
index 8df789f..97942a8 100644 (file)
@@ -32,6 +32,7 @@ public class Host extends TreeClassLoader {
         init(org.ibex.jinetd.Main.ROOT + "/host", "", 0, Main.getRootClassLoader());
     }
     public static void init(String path, String host, int depth, ClassLoader pcl) {
+       if (!new File(path).exists() || !new File(path).isDirectory()) return;
         try {
             InetAddress.getByName(host);
             String pad = "";
@@ -42,8 +43,9 @@ public class Host extends TreeClassLoader {
             if (depth >= 3) return;
         }
         String[] subdirs = new File(path).list();
-        for(int i=0; i<subdirs.length; i++)
-            init(path + File.separatorChar + subdirs[i], host.equals("") ? subdirs[i] : subdirs[i]+"."+host, depth+1, pcl);
+        if (subdirs != null)
+            for(int i=0; i<subdirs.length; i++)
+                init(path + File.separatorChar + subdirs[i], host.equals("") ? subdirs[i] : subdirs[i]+"."+host, depth+1, pcl);
     }
 
 }