Core/Vehicles: Fixed a crash that happened if someone called ExitVehicle during seat changing
This commit is contained in:
1 parent
5f16aad092
commit
16f9a9d1b4
3 files changed
+23
-8
No files matched your search
@@ -16605,7 +16605,12 @@ void Unit::ChangeSeat(int8 seatId, bool next)
|
||||
// Todo: the functions below could be consolidated and refactored to take
|
||||
// SeatMap::const_iterator as parameter, to save redundant map lookups.
|
||||
m_vehicle->RemovePassenger(this);
|
||||
if (!m_vehicle->AddPassenger(this, seatId))
|
||||
|
||||
// Set m_vehicle to NULL before adding passenger as adding new passengers is handled asynchronously
|
||||
// and someone may call ExitVehicle again before passenger is added to new seat
|
||||
Vehicle* veh = m_vehicle;
|
||||
m_vehicle = NULL;
|
||||
if (!veh->AddPassenger(this, seatId))
|
||||
ASSERT(false);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user