EsotericSoftware / spine-runtimes

2D skeletal animation runtimes for Spine.
http://esotericsoftware.com/
Other
4.42k stars 2.92k forks source link

[cpp] avoid null pointer deference in PhysicsConstraintTimeline #2694

Open bendmorris opened 2 days ago

bendmorris commented 2 days ago

Compiling spine-cpp with mingw and -Werror results in:

/home/ben/Dev/march/krit/spine-runtimes/spine-cpp/spine-cpp/src/spine/PhysicsConstraintTimeline.cpp:98:75: error: ‘this’ pointer is null [-Werror=nonnull]
   98 |                                 if (constraint->_active) constraint->reset();
      | 

This looks like a real issue as constraint is definitely null here. The intent seems pretty clear though so here's a quick fix - feel free to throw it away and fix it a different way.