From 407b003f7d584eb0bf133e7ec8f61c6d6485ec17 Mon Sep 17 00:00:00 2001 From: Alex King <89047260+Kinglykrab@users.noreply.github.com> Date: Sat, 1 Apr 2023 14:22:52 -0400 Subject: [PATCH] [Cleanup] Add client pointer validation to Zone::GetClosestZonePoint() (#3173) # Notes - We were not validating pointer here, could cause issues. --- zone/zone.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zone/zone.cpp b/zone/zone.cpp index b3139fc0f..23104485b 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -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 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();