Avoid crashs of invalid item ids in otb files

This commit is contained in:
Eduardo Bart 2012-07-27 18:25:41 -03:00
parent 7aba117cf2
commit a88e9f9e0f
1 changed files with 5 additions and 1 deletions

View File

@ -188,8 +188,12 @@ void Item::setOtbId(uint16 id)
if(!g_things.isValidOtbId(id))
id = 0;
auto itemType = g_things.getItemType(id);
m_id = itemType->getClientId();
m_otbId = id;
id = itemType->getClientId();
if(!g_things.isValidDatId(id, ThingCategoryItem))
id = 0;
m_id = id;
}
bool Item::isValid()