aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2013-10-28 20:32:56 +0100
committerjackpoz <giacomopoz@gmail.com>2013-10-28 20:32:56 +0100
commitf002b0552bf9c782d53e033fd42662d55ce0259b (patch)
tree37b044926f0c8e1fe3be6616bdc6697ccf27d027 /src
parentf81316a5ebdce39ea6ca58b24f9688404005380e (diff)
Core/Vehicles: Add missing NULL check in cf72f7cc5cf13607dd7353b8d940d56679b6956b
Add an additional NULL check for me->GetVehicleKit() , otherwise the crash fixed in cf72f7cc5cf13607dd7353b8d940d56679b6956b becomes a NULL dereference crash.
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/CoreAI/CombatAI.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/server/game/AI/CoreAI/CombatAI.cpp b/src/server/game/AI/CoreAI/CombatAI.cpp
index e08bd65c091..3ad52aedb34 100644
--- a/src/server/game/AI/CoreAI/CombatAI.cpp
+++ b/src/server/game/AI/CoreAI/CombatAI.cpp
@@ -330,18 +330,19 @@ void VehicleAI::CheckConditions(const uint32 diff)
{
if (!conditions.empty())
{
- for (SeatMap::iterator itr = me->GetVehicleKit()->Seats.begin(); itr != me->GetVehicleKit()->Seats.end(); ++itr)
- if (Unit* passenger = ObjectAccessor::GetUnit(*me, itr->second.Passenger.Guid))
- {
- if (Player* player = passenger->ToPlayer())
+ if( Vehicle* vehicleKit = me->GetVehicleKit())
+ for (SeatMap::iterator itr = vehicleKit->Seats.begin(); itr != vehicleKit->Seats.end(); ++itr)
+ if (Unit* passenger = ObjectAccessor::GetUnit(*me, itr->second.Passenger.Guid))
{
- if (!sConditionMgr->IsObjectMeetToConditions(player, me, conditions))
+ if (Player* player = passenger->ToPlayer())
{
- player->ExitVehicle();
- return;//check other pessanger in next tick
+ if (!sConditionMgr->IsObjectMeetToConditions(player, me, conditions))
+ {
+ player->ExitVehicle();
+ return;//check other pessanger in next tick
+ }
}
}
- }
}
m_ConditionsTimer = VEHICLE_CONDITION_CHECK_TIME;
}