From 80242bd2505460f292251985a960e4d0fbe9d1d5 Mon Sep 17 00:00:00 2001 From: KimLS Date: Mon, 8 Sep 2014 17:02:37 -0700 Subject: [PATCH] Strange crash hack/workaround that occured on peq --- zone/groups.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/zone/groups.cpp b/zone/groups.cpp index 5c34cf359..c73b8f093 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -561,6 +561,18 @@ bool Group::DelMember(Mob* oldmember,bool ignoresender) } } + /* This may seem pointless but the case above does not cover the following situation: + * Group has Leader a, member b, member c + * b and c are out of zone + * a disconnects/quits + * b or c zone back in and disconnects/quits + * a is still "leader" from GetLeader()'s perspective and will crash the zone when we DelMember(b) + * Ultimately we should think up a better solution to this. + */ + if(oldmember == GetLeader()) { + SetLeader(nullptr); + } + ServerPacket* pack = new ServerPacket(ServerOP_GroupLeave, sizeof(ServerGroupLeave_Struct)); ServerGroupLeave_Struct* gl = (ServerGroupLeave_Struct*)pack->pBuffer; gl->gid = GetID();