Explorar o código

Fix NPE on server shutdown with no user data

nossr50 %!s(int64=6) %!d(string=hai) anos
pai
achega
a677450d50
Modificáronse 3 ficheiros con 7 adicións e 1 borrados
  1. 3 0
      Changelog.txt
  2. 1 1
      pom.xml
  3. 3 0
      src/main/java/com/gmail/nossr50/util/player/UserManager.java

+ 3 - 0
Changelog.txt

@@ -1,3 +1,6 @@
+Version 2.1.72
+    Fixed a NPE if a server shutdown with no player data needing to be saved (the error is harmless but spammy)
+
 Version 2.1.71
     Salvage will now always ask for confirmation before breaking your items (instead of only asking for enchanted items)
     Repair will now always ask for confirmation before repairing items (instead of only asking for enchanted items)

+ 1 - 1
pom.xml

@@ -2,7 +2,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.gmail.nossr50.mcMMO</groupId>
     <artifactId>mcMMO</artifactId>
-    <version>2.1.71</version>
+    <version>2.1.72-SNAPSHOT</version>
     <name>mcMMO</name>
     <url>https://github.com/mcMMO-Dev/mcMMO</url>
     <scm>

+ 3 - 0
src/main/java/com/gmail/nossr50/util/player/UserManager.java

@@ -66,6 +66,9 @@ public final class UserManager {
      * Save all users ON THIS THREAD.
      */
     public static void saveAll() {
+        if(playerDataSet == null)
+            return;
+
         ImmutableList<McMMOPlayer> trackedSyncData = ImmutableList.copyOf(playerDataSet);
 
         mcMMO.p.getLogger().info("Saving mcMMOPlayers... (" + trackedSyncData.size() + ")");