jrouwe / JoltPhysics

A multi core friendly rigid body physics and collision detection library. Written in C++. Suitable for games and VR applications. Used by Horizon Forbidden West.
MIT License
6.77k stars 452 forks source link

ConstraintManager Add/Remove crashes with nullptrs #1258

Closed lukas-toenne closed 2 months ago

lukas-toenne commented 2 months ago

The documentation for ConstraintManager::Add and ConstraintManager::Remove functions (and the PhysicsSystem wrappers) says they support nullptrs in the arrays.

/// Note that the inConstraints array is allowed to have nullptrs, these will be ignored.

But the code still accesses the pointers without checks and crashes when the array contains nullptrs.

https://github.com/jrouwe/JoltPhysics/blob/2292c415a9a94cd7b4706de6ac8f24c9b5af74a5/Jolt/Physics/Constraints/ConstraintManager.cpp#L31

jrouwe commented 2 months ago

Sorry about that, this used to be the case in an earlier version of Jolt. It is indeed not true anymore.

I've fixed the comment. Thanks for reporting!