Skip to content

Commit f57883b

Browse files
committed
fix NPE
1 parent d76ad3f commit f57883b

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/main/java/com/falsepattern/chunk/internal/ChunkDataRegistryImpl.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ private static String verifyManagerCompatibility(NBTTagCompound tag) {
284284
StringBuilder builder = new StringBuilder();
285285
val saveManagers = readManagers(tag);
286286
val removedManagers = new HashSet<>(saveManagers.keySet());
287-
removedManagers.removeAll(managers);
287+
removedManagers.removeAll(NBTManagers.keySet());
288288
if (!removedManagers.isEmpty()) {
289289
compatWarning = true;
290290
builder.append("\nThe following data managers are no longer present:\n");
@@ -301,15 +301,18 @@ private static String verifyManagerCompatibility(NBTTagCompound tag) {
301301
builder.append('\n');
302302
}
303303
}
304-
val addedManagers = managers.stream()
305-
.filter(manager -> !manager.startsWith("minecraft:"))
306-
.filter(manager -> !saveManagers.containsKey(manager))
307-
.collect(Collectors.toSet());
304+
val addedManagers = NBTManagers.keySet()
305+
.stream()
306+
.filter(manager -> !manager.startsWith("minecraft:"))
307+
.filter(manager -> !saveManagers.containsKey(manager))
308+
.collect(Collectors.toSet());
308309
if (!addedManagers.isEmpty()) {
309310
compatWarning = true;
310311
builder.append("\nThe following data managers have been newly added:\n");
311312
for (val manager: addedManagers) {
312313
val addedManager = NBTManagers.get(manager);
314+
if (addedManager == null)
315+
continue;
313316
builder.append(manager)
314317
.append(' ').append(addedManager.version()).append('\n');
315318
val installMessage = addedManager.newInstallDescription();
@@ -320,7 +323,7 @@ private static String verifyManagerCompatibility(NBTTagCompound tag) {
320323
boolean changePrompt = false;
321324
for (val savedManager: saveManagers.entrySet()) {
322325
val managerName = savedManager.getKey();
323-
if (managers.contains(managerName)) {
326+
if (NBTManagers.containsKey(managerName)) {
324327
val manager = savedManager.getValue();
325328
val currentManager = NBTManagers.get(managerName);
326329
val extraMessage = currentManager.versionChangeMessage(manager.version);

0 commit comments

Comments
 (0)