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
+5 -3
View File
@@ -2007,7 +2007,7 @@ void Client::DyeArmor(DyeStruct* dye){
bool Client::DecreaseByID(uint32 type, uint8 amt) {
const Item_Struct* TempItem = 0;
ItemInst* ins;
ItemInst* ins = nullptr;
int x;
int num = 0;
for(x = EmuConstants::EQUIPMENT_BEGIN; x <= EmuConstants::GENERAL_BAGS_END; x++)
@@ -2143,6 +2143,7 @@ void Client::RemoveNoRent(bool client_update) {
std::list<ItemInst*>::iterator iter = local.begin();
while (iter != local.end()) {
inst = *iter;
// should probably put a check here for valid pointer..but, that was checked when the item was put into inventory -U
if (!inst->GetItem()->NoRent)
mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from `Limbo`", inst->GetItem()->Name);
else
@@ -2268,6 +2269,7 @@ void Client::RemoveDuplicateLore(bool client_update) {
std::list<ItemInst*>::iterator iter = local.begin();
while (iter != local.end()) {
inst = *iter;
// probably needs a valid pointer check -U
if (CheckLoreConflict(inst->GetItem())) {
mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name);
safe_delete(*iter);
@@ -2470,8 +2472,8 @@ void Client::CreateBandolier(const EQApplicationPacket *app) {
_log(INVENTORY__BANDOLIER, "Char: %s Creating Bandolier Set %i, Set Name: %s", GetName(), bs->number, bs->name);
strcpy(m_pp.bandoliers[bs->number].name, bs->name);
const ItemInst* InvItem;
const Item_Struct *BaseItem;
const ItemInst* InvItem = nullptr;
const Item_Struct *BaseItem = nullptr;
int16 WeaponSlot;
for(int BandolierSlot = bandolierMainHand; BandolierSlot <= bandolierAmmo; BandolierSlot++) {