From 4281730b16608714584c410a5e2111dae461b6bc Mon Sep 17 00:00:00 2001 From: withmorten Date: Tue, 2 Feb 2021 11:27:30 +0100 Subject: [PATCH] fix UB and potential crashes when doing ice cream --- src/peds/PedAttractor.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/peds/PedAttractor.cpp b/src/peds/PedAttractor.cpp index de587270..11fb5b31 100644 --- a/src/peds/PedAttractor.cpp +++ b/src/peds/PedAttractor.cpp @@ -113,7 +113,11 @@ const C2dEffect* CPedAttractorManager::GetEffectForIceCreamVan(CVehicle* pVehicl CVehicleToEffect effect(pVehicle); vVehicleToEffect.push_back(effect); POP_MEMID(); +#ifdef FIX_BUGS + return vVehicleToEffect.back().ChooseEffect(pos); +#else return effect.ChooseEffect(pos); +#endif } CVehicle* CPedAttractorManager::GetIceCreamVanForEffect(C2dEffect* pEffect)