[Bug Fix] Fix crash in Client::Handle_OP_GMGoto (#3832)

# Notes
- Logic was incorrect.
This commit is contained in:
Alex King 2023-12-31 15:45:08 -05:00 committed by GitHub
parent a0f2a8a743
commit 2f4af4f0c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6598,17 +6598,26 @@ void Client::Handle_OP_GMGoto(const EQApplicationPacket *app)
auto *gmg = (GMSummon_Struct *) app->pBuffer;
Mob *gt = entity_list.GetMob(gmg->charname);
if (!gt) {
MovePC(zone->GetZoneID(), zone->GetInstanceID(), gt->GetX(), gt->GetY(), gt->GetZ(), gt->GetHeading());
if (gt) {
MovePC(
zone->GetZoneID(),
zone->GetInstanceID(),
gt->GetX(),
gt->GetY(),
gt->GetZ(),
gt->GetHeading()
);
} else if (!worldserver.Connected()) {
Message(Chat::Red, "Error: World server disconnected.");
} else {
auto pack = new ServerPacket(ServerOP_GMGoto, sizeof(ServerGMGoto_Struct));
memset(pack->pBuffer, 0, pack->size);
ServerGMGoto_Struct *wsgmg = (ServerGMGoto_Struct *) pack->pBuffer;
strcpy(wsgmg->myname, GetName());
strcpy(wsgmg->gotoname, gmg->charname);
wsgmg->admin = admin;
auto* g = (ServerGMGoto_Struct *) pack->pBuffer;
strcpy(g->myname, GetName());
strcpy(g->gotoname, gmg->charname);
g->admin = admin;
worldserver.SendPacket(pack);
safe_delete(pack);
}