Null check onComplete parameter for scheduleChunkLoad with gen = false

When gen = true, the parameter may be null. There is no reason it
should NPE then when gen = false.
This commit is contained in:
Spottedleaf
2024-06-19 08:18:58 -07:00
parent ed3e278562
commit 393bd84ca8

View File

@@ -457,12 +457,16 @@ public final class ChunkTaskScheduler {
}
this.scheduleChunkLoad(chunkX, chunkZ, ChunkStatus.EMPTY, addTicket, priority, (final ChunkAccess chunk) -> {
if (chunk == null) {
onComplete.accept(null);
if (onComplete != null) {
onComplete.accept(null);
}
} else {
if (chunk.getPersistedStatus().isOrAfter(toStatus)) {
this.scheduleChunkLoad(chunkX, chunkZ, toStatus, addTicket, priority, onComplete);
} else {
onComplete.accept(null);
if (onComplete != null) {
onComplete.accept(null);
}
}
}
});