mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-19 13:28:25 +00:00
Made Merc::AddMercToGroup handle cleaning up old groups as opposed to doing it in each location before AddMercToGroup. This should fix cases where the Merc's owner is invalid and being referenced, which causes the crash located in:
http://www.eqemulator.org/forums/showthread.php?t=36670&page=2
This commit is contained in:
+6
-7
@@ -5839,16 +5839,15 @@ bool Merc::AddMercToGroup(Merc* merc, Group* group) {
|
||||
if(merc->HasGroup()) {
|
||||
Merc::RemoveMercFromGroup(merc, merc->GetGroup());
|
||||
}
|
||||
// Add merc to this group
|
||||
if(group->AddMember(merc)) {
|
||||
merc->SetFollowID(merc->GetMercOwner()->GetID());
|
||||
Result = true;
|
||||
//Try and add the member, followed by checking if the merc owner exists.
|
||||
if(group->AddMember(merc) && merc->GetMercOwner() != NULL) {
|
||||
merc->SetFollowID(merc->GetMercOwner()->GetID());
|
||||
Result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
//Suspend it if the member is not added and the merc's owner is not valid.
|
||||
merc->Suspend();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return Result;
|
||||
|
||||
Reference in New Issue
Block a user