Detect null unit pointer in Items::createItem()

develop
lethosor 2015-06-09 14:02:42 -04:00
parent bb93f2e40f
commit d663784707
1 changed files with 1 additions and 0 deletions

@ -1336,6 +1336,7 @@ int Items::getValue(df::item *item)
int32_t Items::createItem(df::item_type item_type, int16_t item_subtype, int16_t mat_type, int32_t mat_index, df::unit* unit) { int32_t Items::createItem(df::item_type item_type, int16_t item_subtype, int16_t mat_type, int32_t mat_index, df::unit* unit) {
//based on Quietust's plugins/createitem.cpp //based on Quietust's plugins/createitem.cpp
CHECK_NULL_POINTER(unit);
df::map_block* block = Maps::getTileBlock(unit->pos.x, unit->pos.y, unit->pos.z); df::map_block* block = Maps::getTileBlock(unit->pos.x, unit->pos.y, unit->pos.z);
CHECK_NULL_POINTER(block); CHECK_NULL_POINTER(block);
df::reaction_product_itemst* prod = df::allocate<df::reaction_product_itemst>(); df::reaction_product_itemst* prod = df::allocate<df::reaction_product_itemst>();