mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
World: fixed crash when using unloadChunk() during ChunkPopulateEvent, ChunkLoadEvent or when using ChunkListeners
I sure hope there isn't any other cases where this edge case can appear ... closes #5022
This commit is contained in:
parent
869d340f10
commit
593a4b65ea
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user