Fix cBlockArea null deref
This commit is contained in:
parent
fe42538349
commit
f0f001c10d
@ -733,7 +733,8 @@ void cBlockArea::Crop(int a_AddMinX, int a_SubMaxX, int a_AddMinY, int a_SubMaxY
|
||||
{
|
||||
CropNibbles(m_BlockSkyLight, a_AddMinX, a_SubMaxX, a_AddMinY, a_SubMaxY, a_AddMinZ, a_SubMaxZ);
|
||||
}
|
||||
|
||||
if (HasBlockEntities())
|
||||
{
|
||||
auto maxX = m_Size.x - a_SubMaxX;
|
||||
auto maxY = m_Size.y - a_SubMaxY;
|
||||
auto maxZ = m_Size.z - a_SubMaxZ;
|
||||
@ -766,6 +767,7 @@ void cBlockArea::Crop(int a_AddMinX, int a_SubMaxX, int a_AddMinY, int a_SubMaxY
|
||||
m_BlockEntities->insert({MakeIndex(posX, posY, posZ), std::move(be)});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_Origin.Move(a_AddMinX, a_AddMinY, a_AddMinZ);
|
||||
m_Size.x -= a_AddMinX + a_SubMaxX;
|
||||
@ -795,7 +797,8 @@ void cBlockArea::Expand(int a_SubMinX, int a_AddMaxX, int a_SubMinY, int a_AddMa
|
||||
{
|
||||
ExpandNibbles(m_BlockSkyLight, a_SubMinX, a_AddMaxX, a_SubMinY, a_AddMaxY, a_SubMinZ, a_AddMaxZ);
|
||||
}
|
||||
|
||||
if (HasBlockEntities())
|
||||
{
|
||||
// Move block entities:
|
||||
cBlockEntities oldBE;
|
||||
std::swap(oldBE, *m_BlockEntities);
|
||||
@ -808,6 +811,7 @@ void cBlockArea::Expand(int a_SubMinX, int a_AddMaxX, int a_SubMinY, int a_AddMa
|
||||
be->SetPos(posX, posY, posZ);
|
||||
m_BlockEntities->insert({MakeIndex(posX, posY, posZ), std::move(be)});
|
||||
}
|
||||
}
|
||||
|
||||
m_Origin.Move(-a_SubMinX, -a_SubMinY, -a_SubMinZ);
|
||||
m_Size.x += a_SubMinX + a_AddMaxX;
|
||||
|
Loading…
Reference in New Issue
Block a user