Fix for #13255: Check if client has a block even if the server has unloaded it. (#13256)

This commit is contained in:
lhofhansl 2023-02-27 09:57:03 -08:00 committed by GitHub
parent fe3ea090d1
commit fbbdae93ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -298,11 +298,10 @@ void RemoteClient::GetNextBlocks (
Check if map has this block Check if map has this block
*/ */
MapBlock *block = env->getMap().getBlockNoCreateNoEx(p); MapBlock *block = env->getMap().getBlockNoCreateNoEx(p);
bool block_not_found = false;
if (block) { if (block) {
// Reset usage timer, this block will be of use in the future. // First: Reset usage timer, this block will be of use in the future.
block->resetUsageTimer(); block->resetUsageTimer();
}
/* /*
Don't send already sent blocks Don't send already sent blocks
@ -310,6 +309,8 @@ void RemoteClient::GetNextBlocks (
if (m_blocks_sent.find(p) != m_blocks_sent.end()) if (m_blocks_sent.find(p) != m_blocks_sent.end())
continue; continue;
bool block_not_found = false;
if (block) {
// Check whether the block exists (with data) // Check whether the block exists (with data)
if (!block->isGenerated()) if (!block->isGenerated())
block_not_found = true; block_not_found = true;