mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-14 19:51:29 +00:00
Merge pull request #1097 from SecretsOTheP/null_ptr_fixes
Null ptr fixes
This commit is contained in:
commit
ecf47a0bbb
@ -2476,7 +2476,7 @@ void EntityList::RemoveAllGroups()
|
|||||||
while (group_list.size()) {
|
while (group_list.size()) {
|
||||||
auto group = group_list.front();
|
auto group = group_list.front();
|
||||||
group_list.pop_front();
|
group_list.pop_front();
|
||||||
delete group;
|
safe_delete(group);
|
||||||
}
|
}
|
||||||
#if EQDEBUG >= 5
|
#if EQDEBUG >= 5
|
||||||
CheckGroupList (__FILE__, __LINE__);
|
CheckGroupList (__FILE__, __LINE__);
|
||||||
@ -2488,7 +2488,7 @@ void EntityList::RemoveAllRaids()
|
|||||||
while (raid_list.size()) {
|
while (raid_list.size()) {
|
||||||
auto raid = raid_list.front();
|
auto raid = raid_list.front();
|
||||||
raid_list.pop_front();
|
raid_list.pop_front();
|
||||||
delete raid;
|
safe_delete(raid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2837,7 +2837,7 @@ bool EntityList::RemoveGroup(uint32 delete_id)
|
|||||||
}
|
}
|
||||||
auto group = *it;
|
auto group = *it;
|
||||||
group_list.erase(it);
|
group_list.erase(it);
|
||||||
delete group;
|
safe_delete(group);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2849,7 +2849,7 @@ bool EntityList::RemoveRaid(uint32 delete_id)
|
|||||||
return false;
|
return false;
|
||||||
auto raid = *it;
|
auto raid = *it;
|
||||||
raid_list.erase(it);
|
raid_list.erase(it);
|
||||||
delete raid;
|
safe_delete(raid);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -498,6 +498,9 @@ void Group::SendEndurancePacketFrom(Mob* member)
|
|||||||
//if the group was in the zone already
|
//if the group was in the zone already
|
||||||
bool Group::UpdatePlayer(Mob* update){
|
bool Group::UpdatePlayer(Mob* update){
|
||||||
|
|
||||||
|
if (!update)
|
||||||
|
return false;
|
||||||
|
|
||||||
bool updateSuccess = false;
|
bool updateSuccess = false;
|
||||||
|
|
||||||
VerifyGroup();
|
VerifyGroup();
|
||||||
@ -1009,6 +1012,7 @@ void Group::DisbandGroup(bool joinraid) {
|
|||||||
Leader->UpdateLFP();
|
Leader->UpdateLFP();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetLeader(nullptr);
|
||||||
safe_delete(outapp);
|
safe_delete(outapp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -279,6 +279,8 @@ void Raid::SetRaidLeader(const char *wasLead, const char *name)
|
|||||||
Client *c = entity_list.GetClientByName(name);
|
Client *c = entity_list.GetClientByName(name);
|
||||||
if(c)
|
if(c)
|
||||||
SetLeader(c);
|
SetLeader(c);
|
||||||
|
else
|
||||||
|
SetLeader(nullptr); //sanity check, should never get hit but we want to prefer to NOT crash if we do VerifyRaid and leader never gets set there (raid without a leader?)
|
||||||
|
|
||||||
LearnMembers();
|
LearnMembers();
|
||||||
VerifyRaid();
|
VerifyRaid();
|
||||||
@ -1549,6 +1551,11 @@ void Raid::VerifyRaid()
|
|||||||
SetLeader(members[x].member);
|
SetLeader(members[x].member);
|
||||||
strn0cpy(leadername, members[x].membername, 64);
|
strn0cpy(leadername, members[x].membername, 64);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//should never happen, but maybe it is?
|
||||||
|
SetLeader(nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1558,6 +1565,11 @@ void Raid::MemberZoned(Client *c)
|
|||||||
if(!c)
|
if(!c)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (leader == c)
|
||||||
|
{
|
||||||
|
leader = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
// Raid::GetGroup() goes over the members as well, this way we go over once
|
// Raid::GetGroup() goes over the members as well, this way we go over once
|
||||||
uint32 gid = RAID_GROUPLESS;
|
uint32 gid = RAID_GROUPLESS;
|
||||||
for(int x = 0; x < MAX_RAID_MEMBERS; x++)
|
for(int x = 0; x < MAX_RAID_MEMBERS; x++)
|
||||||
|
|||||||
@ -857,12 +857,14 @@ void Zone::Shutdown(bool quiet)
|
|||||||
while (!zone->npctable.empty()) {
|
while (!zone->npctable.empty()) {
|
||||||
itr = zone->npctable.begin();
|
itr = zone->npctable.begin();
|
||||||
delete itr->second;
|
delete itr->second;
|
||||||
|
itr->second = nullptr;
|
||||||
zone->npctable.erase(itr);
|
zone->npctable.erase(itr);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!zone->merctable.empty()) {
|
while (!zone->merctable.empty()) {
|
||||||
itr = zone->merctable.begin();
|
itr = zone->merctable.begin();
|
||||||
delete itr->second;
|
delete itr->second;
|
||||||
|
itr->second = nullptr;
|
||||||
zone->merctable.erase(itr);
|
zone->merctable.erase(itr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -872,6 +874,7 @@ void Zone::Shutdown(bool quiet)
|
|||||||
while (!zone->ldon_trap_list.empty()) {
|
while (!zone->ldon_trap_list.empty()) {
|
||||||
itr4 = zone->ldon_trap_list.begin();
|
itr4 = zone->ldon_trap_list.begin();
|
||||||
delete itr4->second;
|
delete itr4->second;
|
||||||
|
itr4->second = nullptr;
|
||||||
zone->ldon_trap_list.erase(itr4);
|
zone->ldon_trap_list.erase(itr4);
|
||||||
}
|
}
|
||||||
zone->ldon_trap_entry_list.clear();
|
zone->ldon_trap_entry_list.clear();
|
||||||
@ -1707,6 +1710,7 @@ bool Zone::Depop(bool StartSpawnTimer) {
|
|||||||
while(!npctable.empty()) {
|
while(!npctable.empty()) {
|
||||||
itr = npctable.begin();
|
itr = npctable.begin();
|
||||||
delete itr->second;
|
delete itr->second;
|
||||||
|
itr->second = nullptr;
|
||||||
npctable.erase(itr);
|
npctable.erase(itr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1723,6 +1727,7 @@ void Zone::ClearNPCTypeCache(int id) {
|
|||||||
auto iter = npctable.begin();
|
auto iter = npctable.begin();
|
||||||
while (iter != npctable.end()) {
|
while (iter != npctable.end()) {
|
||||||
delete iter->second;
|
delete iter->second;
|
||||||
|
iter->second = nullptr;
|
||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
npctable.clear();
|
npctable.clear();
|
||||||
@ -1732,6 +1737,7 @@ void Zone::ClearNPCTypeCache(int id) {
|
|||||||
while (iter != npctable.end()) {
|
while (iter != npctable.end()) {
|
||||||
if (iter->first == (uint32)id) {
|
if (iter->first == (uint32)id) {
|
||||||
delete iter->second;
|
delete iter->second;
|
||||||
|
iter->second = nullptr;
|
||||||
npctable.erase(iter);
|
npctable.erase(iter);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user