Core/Vehicles: Fixed crash happening if a vehicle despawns during handling of control vehicle aura removal
Closes #29290
This commit is contained in:
1 parent
94f7ee4dda
commit
3f6f51489c
1 file changed
+5
-5
@@ -283,11 +283,11 @@ void Vehicle::RemoveAllPassengers()
|
||||
// We don't need to iterate over Seats
|
||||
_me->RemoveAurasByType(SPELL_AURA_CONTROL_VEHICLE);
|
||||
|
||||
// Following the above logic, this assertion should NEVER fail.
|
||||
// Even in 'hacky' cases, there should at least be VEHICLE_SPELL_RIDE_HARDCODED on us.
|
||||
// SeatMap::const_iterator itr;
|
||||
// for (itr = Seats.begin(); itr != Seats.end(); ++itr)
|
||||
// ASSERT(!itr->second.passenger);
|
||||
// Aura script might cause the vehicle to be despawned in the middle of handling SPELL_AURA_CONTROL_VEHICLE removal
|
||||
// In that case, aura effect has already been unregistered but passenger may still be found in Seats
|
||||
for (auto const& [_, seat] : Seats)
|
||||
if (Unit* passenger = ObjectAccessor::GetUnit(*_me, seat.Passenger.Guid))
|
||||
passenger->_ExitVehicle();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user