Skip to content

Commit 0d801d3

Browse files
authored
Merge pull request #277 from IllidanS4/patch-2
Fix crash on invalid surfing vehicle
2 parents 5200e97 + 5e41495 commit 0d801d3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/CPlayerData.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,10 @@ void CPlayerData::Process()
828828
if (m_wSurfingInfo != 0) {
829829
WORD wVehicleId = m_wSurfingInfo;
830830
if (wVehicleId > 0 && wVehicleId < MAX_VEHICLES) { //-V560
831-
m_pPlayer->vecPosition = pNetGame->pVehiclePool->pVehicle[wVehicleId]->vecPosition + m_vecSurfing;
831+
CVehicle *pVehicle = pNetGame->pVehiclePool->pVehicle[wVehicleId];
832+
if (pVehicle) {
833+
m_pPlayer->vecPosition = pVehicle->vecPosition + m_vecSurfing;
834+
}
832835
} else {
833836
WORD wObjectId = m_wSurfingInfo - MAX_VEHICLES;
834837
if (wObjectId > 0 && wObjectId < MAX_OBJECTS) {

0 commit comments

Comments
 (0)