From 5334467f493eb16141f4ad0bce956bc3e19244a0 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 29 Jun 2025 00:23:21 +0200 Subject: Scripts: Fixed possible crashes caused by passing nullptr to Trinity::WorldObjectListSearcher constructor --- src/server/scripts/ExilesReach/zone_exiles_reach.cpp | 4 ++-- src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/scripts/ExilesReach/zone_exiles_reach.cpp b/src/server/scripts/ExilesReach/zone_exiles_reach.cpp index e1b0033f523..7eb00fabbb8 100644 --- a/src/server/scripts/ExilesReach/zone_exiles_reach.cpp +++ b/src/server/scripts/ExilesReach/zone_exiles_reach.cpp @@ -4647,8 +4647,8 @@ struct at_briarpatch_to_plains : AreaTriggerAI std::vector objs; Trinity::ObjectEntryAndPrivateOwnerIfExistsCheck check(player->GetGUID(), conversationId); - Trinity::WorldObjectListSearcher checker(nullptr, objs, check, GRID_MAP_TYPE_MASK_CONVERSATION); - Cell::VisitGridObjects(player, checker, 100.0f); + Trinity::WorldObjectListSearcher searcher(PhasingHandler::GetAlwaysVisiblePhaseShift(), objs, check, GRID_MAP_TYPE_MASK_CONVERSATION); + Cell::VisitGridObjects(player, searcher, 100.0f); if (objs.empty()) Conversation::CreateConversation(conversationId, player, *player, player->GetGUID(), nullptr); diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp index 98c09080b7d..c41dbff9788 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp @@ -22,6 +22,7 @@ #include "GridNotifiersImpl.h" #include "Map.h" #include "ObjectMgr.h" +#include "PhasingHandler.h" #include "Player.h" #include "ScriptMgr.h" #include "WorldStatePackets.h" @@ -155,12 +156,12 @@ uint32 OPvPCapturePointNA::GetAliveGuardsCount() const { Position searchCenter = { -1572.57f, 7945.3f, -22.475f, 2.05949f }; - std::vector guards; + std::vector guards; Trinity::ObjectEntryAndPrivateOwnerIfExistsCheck check(ObjectGuid::Empty, GetControllingFaction() == HORDE ? 18192 : 18256); - Trinity::WorldObjectListSearcher searcher(nullptr, guards, check, GRID_MAP_TYPE_MASK_CREATURE); + Trinity::CreatureListSearcher searcher(PhasingHandler::GetEmptyPhaseShift(), guards, check); Cell::VisitGridObjects(searchCenter.GetPositionX(), searchCenter.GetPositionY(), m_PvP->GetMap(), searcher, SIZE_OF_GRIDS); - return std::count_if(guards.begin(), guards.end(), [](WorldObject* guard) { return guard->IsUnit() && guard->ToUnit()->IsAlive(); }); + return std::ranges::count_if(guards, [](Creature const* guard) { return guard->IsAlive(); }); } Team OPvPCapturePointNA::GetControllingFaction() const -- cgit v1.2.3