diff src/org/tmatesoft/hg/util/FileWalker.java @ 228:fffe4f882248

NPE when directory doesn't exist
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 27 May 2011 03:01:26 +0200
parents 26ad7827a62d
children 1ec6b327a6ac
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/util/FileWalker.java	Wed May 25 13:13:36 2011 +0200
+++ b/src/org/tmatesoft/hg/util/FileWalker.java	Fri May 27 03:01:26 2011 +0200
@@ -74,9 +74,12 @@
 		return true; // no limits, all files are of interest
 	}
 	
+	// returns non-null
 	private File[] listFiles(File f) {
 		// in case we need to solve os-related file issues (mac with some encodings?)
-		return f.listFiles();
+		File[] rv = f.listFiles();
+		// there are chances directory we query files for is missing (deleted), just treat it as empty
+		return rv == null ? new File[0] : rv;
 	}
 
 	// return true when fill added any elements to fileQueue.