History

add asserts to catch dangling pointers sooner

Andrew Meadows committed 9 years ago

Commit 971855e1 parent c22e4ef2 files · +4 −0Browse files

Showing the changes to libraries/physics/src/ObjectMotionState.cpp (1 of 2 files). Show all

Unified · Split

libraries/physics/src/ObjectMotionState.cpp+2−0
@@ -202,6 +202,7 @@ void ObjectMotionState::setShape(const btCollisionShape* shape) { · 201 unmodified lines
202202 }
203203
204204 void ObjectMotionState::handleEasyChanges(uint32_t& flags) {
205+ assert(_body && _shape);
205206 if (flags & Simulation::DIRTY_POSITION) {
206207 btTransform worldTrans = _body->getWorldTransform();
207208 btVector3 newPosition = glmToBullet(getObjectPosition());
@@ -282,6 +283,7 @@ void ObjectMotionState::handleEasyChanges(uint32_t& flags) { · 74 unmodified lines
282283 }
283284
284285 bool ObjectMotionState::handleHardAndEasyChanges(uint32_t& flags, PhysicsEngine* engine) {
286+ assert(_body && _shape);
285287 if (flags & Simulation::DIRTY_SHAPE) {
286288 // make sure the new shape is valid
287289 if (!isReadyToComputeShape()) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t