diff --git a/src/world/World.php b/src/world/World.php index 9be1d06e4..49c6686ee 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -3043,9 +3043,14 @@ class World implements ChunkManager{ unset($this->activeChunkPopulationTasks[$index]); if($dirtyChunks === 0){ - $promise = $this->chunkPopulationRequestMap[$index]; - unset($this->chunkPopulationRequestMap[$index]); - $promise->resolve($chunk); + $promise = $this->chunkPopulationRequestMap[$index] ?? null; + if($promise !== null){ + unset($this->chunkPopulationRequestMap[$index]); + $promise->resolve($chunk); + }else{ + //Handlers of ChunkPopulateEvent, ChunkLoadEvent, or just ChunkListeners can cause this + $this->logger->debug("Unable to resolve population promise for chunk x=$x,z=$z - populated chunk was forcibly unloaded while setting modified chunks"); + } }else{ //request failed, stick it back on the queue //we didn't resolve the promise or touch it in any way, so any fake chunk loaders are still valid and