Added some nullptr checks for ItemInst* in a few places (tradeskills.cpp - particularly augments - needs a better review)

This commit is contained in:
Uleat
2014-12-23 10:14:45 -05:00
parent ed257b0ef3
commit 34ab3e10f5
14 changed files with 123 additions and 46 deletions
+21 -14
View File
@@ -1195,22 +1195,29 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot,
uint32 recastdelay = 0;
uint32 recasttype = 0;
for (int r = 0; r < EmuConstants::ITEM_COMMON_SIZE; r++) {
const ItemInst* aug_i = inst->GetAugment(r);
if(!aug_i)
continue;
const Item_Struct* aug = aug_i->GetItem();
if(!aug)
continue;
if ( aug->Click.Effect == spell_id )
{
recastdelay = aug_i->GetItem()->RecastDelay;
recasttype = aug_i->GetItem()->RecastType;
fromaug = true;
while (true) {
if (inst == nullptr)
break;
for (int r = AUG_BEGIN; r < EmuConstants::ITEM_COMMON_SIZE; r++) {
const ItemInst* aug_i = inst->GetAugment(r);
if (!aug_i)
continue;
const Item_Struct* aug = aug_i->GetItem();
if (!aug)
continue;
if (aug->Click.Effect == spell_id)
{
recastdelay = aug_i->GetItem()->RecastDelay;
recasttype = aug_i->GetItem()->RecastType;
fromaug = true;
break;
}
}
break;
}
//Test the aug recast delay