diff options
author | jackpoz <giacomopoz@gmail.com> | 2021-07-04 20:06:21 +0200 |
---|---|---|
committer | jackpoz <giacomopoz@gmail.com> | 2021-07-04 20:06:21 +0200 |
commit | 0c90970b0668df93356d035ecff8124b5dc5c44d (patch) | |
tree | 7726135e9a32fa6032d6175aaa7e36355d11d9a3 /src | |
parent | 479c63661249e7845548954dbe149a59f0a6250e (diff) |
Core/Movement: Better handle cases of passing incomplete data to ReadMovementInfo()
ReadMovementInfo() checks MovementInfo::guid but that field is not always set by the callers. An error is logged in that case, skipping triggering an assert.
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Server/WorldSession.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index e3c9ad3569c..5a6d42fd38f 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -927,7 +927,16 @@ void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo* mi) mi->RemoveMovementFlag((maskToRemove)); #endif - Unit* mover = GetPlayer()->GetGUID() == mi->guid ? GetPlayer() : ObjectAccessor::GetUnit(*GetPlayer(), mi->guid); + Unit* mover = GetGameClient()->GetActivelyMovedUnit(); + if (!mover) + { + if (mi->guid.IsEmpty()) + { + TC_LOG_ERROR("entities.unit", "WorldSession::ReadMovementInfo: GetActivelyMovedUnit() returned no mover and mi->guid is empty, opcode %u", static_cast<uint32>(data.GetOpcode())); + return; + } + mover = GetPlayer()->GetGUID() == mi->guid ? GetPlayer() : ObjectAccessor::GetUnit(*GetPlayer(), mi->guid); + } ASSERT(mover, "if the server allows this unit to be moved by the client, the unit should still exist!"); if (!GetPlayer()->GetVehicleBase() || !(GetPlayer()->GetVehicle()->GetVehicleInfo()->Flags & VEHICLE_FLAG_FIXED_POSITION)) |