From c24bad176f1ee12ffb0329a5cd51d772ad8bbd7b Mon Sep 17 00:00:00 2001 From: Marcos Vives Del Sol Date: Fri, 23 May 2014 20:06:43 +0200 Subject: [PATCH] Fix for #94 --- src/main/java/com/daemitus/deadbolt/PlayerNameUtil.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/daemitus/deadbolt/PlayerNameUtil.java b/src/main/java/com/daemitus/deadbolt/PlayerNameUtil.java index 03865c7..e81c1af 100755 --- a/src/main/java/com/daemitus/deadbolt/PlayerNameUtil.java +++ b/src/main/java/com/daemitus/deadbolt/PlayerNameUtil.java @@ -180,8 +180,13 @@ public static long getLastPlayed(String playerName) { protected synchronized static void populateCaseInsensitiveNameToCaseCorrectName() { + // Check if listFiles returns null (ie folder does not exist) + File[] files = playerfolder.listFiles(); + if (files == null) { + return; + } // Populate by removing .dat - for (File playerfile : playerfolder.listFiles()) + for (File playerfile : files) { String filename = playerfile.getName(); String playername = filename.substring(0, filename.length()-4);