comparison 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
comparison
equal deleted inserted replaced
227:0fd10e5016dd 228:fffe4f882248
72 72
73 public boolean inScope(Path file) { 73 public boolean inScope(Path file) {
74 return true; // no limits, all files are of interest 74 return true; // no limits, all files are of interest
75 } 75 }
76 76
77 // returns non-null
77 private File[] listFiles(File f) { 78 private File[] listFiles(File f) {
78 // in case we need to solve os-related file issues (mac with some encodings?) 79 // in case we need to solve os-related file issues (mac with some encodings?)
79 return f.listFiles(); 80 File[] rv = f.listFiles();
81 // there are chances directory we query files for is missing (deleted), just treat it as empty
82 return rv == null ? new File[0] : rv;
80 } 83 }
81 84
82 // return true when fill added any elements to fileQueue. 85 // return true when fill added any elements to fileQueue.
83 private boolean fill() { 86 private boolean fill() {
84 while (fileQueue.isEmpty()) { 87 while (fileQueue.isEmpty()) {