Skip to content

Commit

Permalink
Null check onComplete parameter for scheduleChunkLoad with gen = false
Browse files Browse the repository at this point in the history
When gen = true, the parameter may be null. There is no reason it
should NPE then when gen = false.
  • Loading branch information
Spottedleaf committed Jun 19, 2024
1 parent ed3e278 commit 393bd84
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -457,12 +457,16 @@ public void scheduleChunkLoad(final int chunkX, final int chunkZ, final boolean
}
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);
}
}
}
});
Expand Down

0 comments on commit 393bd84

Please sign in to comment.