Fix NPE on WatchQueueReader (#2563)

Signed-off-by: Jimmy Tanagra <jimmy@tanagra.id.au>
This commit is contained in:
jimtng 2021-11-11 18:43:24 +10:00 committed by GitHub
parent 85b0910ef1
commit 8343703406
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -337,8 +337,11 @@ public class WatchQueueReader implements Runnable {
Path baseWatchedDir = null;
Path registeredPath = null;
synchronized (this) {
baseWatchedDir = keyToService.get(key).getSourcePath();
registeredPath = registeredKeys.get(key);
AbstractWatchService service = keyToService.get(key);
if (service != null) {
baseWatchedDir = service.getSourcePath();
registeredPath = registeredKeys.get(key);
}
}
if (registeredPath != null) {
// If the path has been registered in the watch service it relative path can be resolved