mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 17:05:44 +01:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user