diff options
| author | QAston <none@none> | 2009-06-24 01:50:59 +0200 |
|---|---|---|
| committer | QAston <none@none> | 2009-06-24 01:50:59 +0200 |
| commit | e58230d5061191756248e2e020910a23afb63b33 (patch) | |
| tree | 418fc8b24a2bfd516500c1fd8e7276701d124d84 /src | |
| parent | 0a7691083d5f6109ca0cd0b336b15052ca5cfba4 (diff) | |
*Add security check to Vehicle::InstallAccessory.
--HG--
branch : trunk
Diffstat (limited to 'src')
| -rw-r--r-- | src/game/Vehicle.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/game/Vehicle.cpp b/src/game/Vehicle.cpp index 0aa0d48a24c..54bb5275f45 100644 --- a/src/game/Vehicle.cpp +++ b/src/game/Vehicle.cpp @@ -266,10 +266,17 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId) if(!accessory) return; - accessory->m_Vehicle = this; - AddPassenger(accessory, seatId); - // This is not good, we have to send update twice - accessory->SendMovementFlagUpdate(); + if (!accessory->m_Vehicle) + { + accessory->m_Vehicle = this; + if (!AddPassenger(accessory, seatId)) + { + accessory->m_Vehicle = NULL; + return; + } + // This is not good, we have to send update twice + accessory->SendMovementFlagUpdate(); + } } bool Vehicle::AddPassenger(Unit *unit, int8 seatId) |
