1
0
Fork 0

Fixed a crash when creating negative-size blockareas.

Now the server emits a warning instead and continues execution.
This commit is contained in:
madmaxoft 2014-06-09 00:49:02 +02:00
parent af4a21ea06
commit ec0976f9b0
1 changed files with 8 additions and 0 deletions

View File

@ -309,6 +309,14 @@ void cBlockArea::Clear(void)
void cBlockArea::Create(int a_SizeX, int a_SizeY, int a_SizeZ, int a_DataTypes)
{
if ((a_SizeX < 0) || (a_SizeY < 0) || (a_SizeZ < 0))
{
LOGWARNING("Creating a cBlockArea with a negative size! Call to Create ignored. (%d, %d, %d)",
a_SizeX, a_SizeY, a_SizeZ
);
return;
}
Clear();
int BlockCount = a_SizeX * a_SizeY * a_SizeZ;
if ((a_DataTypes & baTypes) != 0)