Core/Vehicles: Add missing NULL check in cf72f7cc5c

Add an additional NULL check for me->GetVehicleKit() , otherwise the crash fixed in cf72f7cc5c becomes a NULL dereference crash.
This commit is contained in:
jackpoz
2013-10-28 20:32:56 +01:00
parent f81316a5eb
commit f002b0552b

View File

@@ -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;
}