Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
Core/Vehicles: Fixed crash happening if a vehicle despawns during han…
Browse files Browse the repository at this point in the history
…dling of control vehicle aura removal

Closes #29290
  • Loading branch information
Shauren authored and Ovahlord committed Oct 29, 2023
1 parent 94f7ee4 commit 3f6f514
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/server/game/Entities/Vehicle/Vehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/**
Expand Down

0 comments on commit 3f6f514

Please sign in to comment.