From 413e304845ebd0d7bb5a4fe286f78dd6dfec75ef Mon Sep 17 00:00:00 2001 From: Luck Date: Wed, 14 Jun 2017 17:32:02 +0100 Subject: [PATCH] Fix NPE with null context in FileWatcher --- .../me/lucko/luckperms/common/utils/FileWatcher.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/me/lucko/luckperms/common/utils/FileWatcher.java b/common/src/main/java/me/lucko/luckperms/common/utils/FileWatcher.java index 041636bab..63b7f485d 100644 --- a/common/src/main/java/me/lucko/luckperms/common/utils/FileWatcher.java +++ b/common/src/main/java/me/lucko/luckperms/common/utils/FileWatcher.java @@ -115,10 +115,14 @@ public class FileWatcher implements Runnable { List> 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.