[Cleanup] Add client pointer validation to Zone::GetClosestZonePoint() (#3173)

# Notes
- We were not validating pointer here, could cause issues.
This commit is contained in:
Alex King 2023-04-01 14:22:52 -04:00 committed by GitHub
parent b6d315d803
commit 407b003f7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1998,6 +1998,11 @@ void Zone::SetTime(uint8 hour, uint8 minute, bool update_world /*= true*/)
ZonePoint* Zone::GetClosestZonePoint(const glm::vec3& location, uint32 to, Client* client, float max_distance) {
LinkedListIterator<ZonePoint*> iterator(zone_point_list);
ZonePoint* closest_zp = nullptr;
if (!client) {
return closest_zp;
}
float closest_dist = FLT_MAX;
float max_distance2 = max_distance * max_distance;
iterator.Reset();