Vice City: Multiplayer
Community Projects => SLC's Squirrel Plugin => Bug Reports => Topic started by: EK.IceFlake on May 25th, 2017, 11:06 AM
The title is enough: Getting an unoccupied slot in a vehicle using .Occupant causes a crash
Ah yes, that was clearly a sh!tty choice https://github.com/iSLC/VCMP-SqMod/blob/41e04e5167efd765e25af6e52073f545932bec95/source/Entity/Vehicle.cpp#L262
Not checking whether the returned value is negative or out of bounds. Gonna fix it as soon as I can.
In the mean time, if this is critical, you can validate the ID manually before using the actual thing:
if (vehicle.OccupantID(slot) >= 0)
If you need this to be even stricter:
local oid = vehicle.OccupantID(slot);
if (oid >= 0 && oid < SqPlayer.MaxID)
Should be fixed now.