From: Laszlo T. <ave...@us...> - 2005-07-22 17:17:44
|
Update of /cvsroot/gemrb/gemrb/gemrb/plugins/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17631 Modified Files: GSUtils.cpp Log Message: fixed a crasher in HasItem Index: GSUtils.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/GSUtils.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** GSUtils.cpp 20 Jul 2005 21:46:29 -0000 1.15 --- GSUtils.cpp 22 Jul 2005 17:17:27 -0000 1.16 *************** *** 203,215 **** //maybe we could speed this up if we mark bag items with a flags bit CREItem *itemslot = inventory->GetSlotItem(i); Item *item = core->GetItem(itemslot->ItemResRef); ! if (item) { ! if (item->ItemType==ITM_TYPE_BAG) { ! //the store is the same as the item's name ! bool ret = StoreHasItemCore(itemslot->ItemResRef, itemname); ! core->FreeItem(item, itemslot->ItemResRef); ! if (ret) { ! return true; ! } } } --- 203,217 ---- //maybe we could speed this up if we mark bag items with a flags bit CREItem *itemslot = inventory->GetSlotItem(i); + if (!itemslot) + continue; Item *item = core->GetItem(itemslot->ItemResRef); ! if (!item) ! continue; ! if (item->ItemType==ITM_TYPE_BAG) { ! //the store is the same as the item's name ! bool ret = StoreHasItemCore(itemslot->ItemResRef, itemname); ! core->FreeItem(item, itemslot->ItemResRef); ! if (ret) { ! return true; } } |