Core/Scripts: Fix a crash when swapping creatures with pending vehicle join events.
* Closes #17833 (cherry picked from commit 600e0be7e1f1654a2223ef22559dbd3adb6b100a)
This commit is contained in:
@@ -724,12 +724,6 @@ void Vehicle::RemovePendingEventsForPassenger(Unit* passenger)
|
||||
}
|
||||
}
|
||||
|
||||
VehicleJoinEvent::~VehicleJoinEvent()
|
||||
{
|
||||
if (Target)
|
||||
Target->RemovePendingEvent(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @fn bool VehicleJoinEvent::Execute(uint64, uint32)
|
||||
*
|
||||
@@ -847,6 +841,9 @@ void VehicleJoinEvent::Abort(uint64)
|
||||
TC_LOG_DEBUG("entities.vehicle", "Passenger %s, Entry: %u, board on vehicle %s, Entry: %u SeatId: %d cancelled",
|
||||
Passenger->GetGUID().ToString().c_str(), Passenger->GetEntry(), Target->GetBase()->GetGUID().ToString().c_str(), Target->GetBase()->GetEntry(), (int32)Seat->first);
|
||||
|
||||
/// Remove the pending event when Abort was called on the event directly
|
||||
Target->RemovePendingEvent(this);
|
||||
|
||||
/// @SPELL_AURA_CONTROL_VEHICLE auras can be applied even when the passenger is not (yet) on the vehicle.
|
||||
/// When this code is triggered it means that something went wrong in @Vehicle::AddPassenger, and we should remove
|
||||
/// the aura manually.
|
||||
|
||||
@@ -123,7 +123,6 @@ class TC_GAME_API VehicleJoinEvent : public BasicEvent
|
||||
friend class Vehicle;
|
||||
protected:
|
||||
VehicleJoinEvent(Vehicle* v, Unit* u) : Target(v), Passenger(u), Seat(Target->Seats.end()) { }
|
||||
~VehicleJoinEvent();
|
||||
bool Execute(uint64, uint32) override;
|
||||
void Abort(uint64) override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user