Fix NPE with null context in FileWatcher

This commit is contained in:
Luck 2017-06-14 17:32:02 +01:00
parent 046daf23d0
commit 413e304845
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B

View File

@ -115,10 +115,14 @@ public class FileWatcher implements Runnable {
List<WatchEvent<?>> watchEvents = key.pollEvents();
for (WatchEvent<?> event : watchEvents) {
Path name = (Path) event.context();
Path file = path.resolve(name);
Path context = (Path) event.context();
String fileName = name.toString();
if (context == null) {
continue;
}
Path file = path.resolve(context);
String fileName = context.toString();
if (internalChanges.containsKey(id + "/" + fileName)) {
// This file was modified by the system.