Skip to content

nullptr dereference when a player driven vehicle is destroyed #1

@Asdow

Description

@Asdow

How to replicate: In tactical mode, put a soldier inside a vehicle, eg. ice cream truck and force move it through buildings with shift+click until it explodes.

nullptr dereference in renderworld.cpp GetShadeTable due to psoldier->sGridNo being -1, which is then used for array access. Simply preventing the nullptr dereference shows that intact vehicle graphics are not properly removed from the tactical map, unlike merc graphics are which results in undamaged vehicle graphics being shown under the vehicle corpse graphics. Proper fix requires going through the code and finding out where the removal of vehicle from the tactical map goes wrong. If the vehicle is removed from the merc list in strategic map, the vehicle graphics disappear from tactical map as well.

RemoveMerc() returns FALSE due to not finding the vehicle pSoldier in gpWorldLevelData[ iMapIndex ].pLevelNodes[5] for the sGridNo that the vehicle is supposed to be on. Maybe a mismatch of where the structure in world is not yet updated to the vehicle's current gridno when it gets destroyed? This bug does happen when the vehicle is moving in tactical

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions