Check NULL pointer properly in some new code trying to log new stuff

This commit is contained in:
Perttu Ahola 2011-10-16 18:50:30 +03:00
parent 369177aa80
commit 96b2d1fd29
1 changed files with 4 additions and 1 deletions

View File

@ -3045,8 +3045,11 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
player->inventory.getList("craftresult");
assert(list);
InventoryItem *item = list->getItem(0);
std::string itemname = "NULL";
if(item)
itemname = item->getName();
actionstream<<player->getName()<<" crafts "
<<item->getName()<<std::endl;
<<itemname<<std::endl;
}
/*
If the craftresult is placed on itself, move it to