1
0

Prevent bookshelf pickup crash

If no tool was involved in the creation of a bookshelf pickup (e.g. explosion), the server would crash due to a missing nullptr check. Removed the IsTool check completely, since we don't use it elsewhere, and vanilla doesn't do such checks either.
This commit is contained in:
mathiascode 2020-04-24 19:39:22 +03:00
parent afd377a941
commit e6cc792cef

View File

@ -17,7 +17,7 @@ class cBlockBookShelfHandler :
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, cBlockEntity * a_BlockEntity, const cEntity * a_Digger, const cItem * a_Tool) override virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, cBlockEntity * a_BlockEntity, const cEntity * a_Digger, const cItem * a_Tool) override
{ {
if ((ItemCategory::IsTool(a_Tool->m_ItemType)) && (ToolHasSilkTouch(a_Tool))) if (ToolHasSilkTouch(a_Tool))
{ {
return cItem(m_BlockType, 1); return cItem(m_BlockType, 1);
} }