1
0

Item-loading now checks for weird bytes.

This commit is contained in:
madmaxoft 2014-01-26 14:43:54 +01:00
parent a3ac1be7b7
commit 61848ff5a0

View File

@ -611,12 +611,18 @@ void cWSSAnvil::LoadBlockEntitiesFromNBT(cBlockEntityList & a_BlockEntities, con
bool cWSSAnvil::LoadItemFromNBT(cItem & a_Item, const cParsedNBT & a_NBT, int a_TagIdx)
{
int ID = a_NBT.FindChildByName(a_TagIdx, "id");
if ((ID < 0) || (a_NBT.GetType(ID) != TAG_Short))
int Type = a_NBT.FindChildByName(a_TagIdx, "id");
if ((Type < 0) || (a_NBT.GetType(Type) != TAG_Short))
{
return false;
}
a_Item.m_ItemType = (ENUM_ITEM_ID)(a_NBT.GetShort(ID));
a_Item.m_ItemType = a_NBT.GetShort(Type);
if (a_Item.m_ItemType < 0)
{
LOGD("Encountered an item with negative type (%d). Replacing with an empty item.", a_NBT.GetShort(Type));
a_Item.Empty();
return true;
}
int Damage = a_NBT.FindChildByName(a_TagIdx, "Damage");
if ((Damage < 0) || (a_NBT.GetType(Damage) != TAG_Short))