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
202}202}
203 203
204void ObjectMotionState::handleEasyChanges(uint32_t& flags) {204void ObjectMotionState::handleEasyChanges(uint32_t& flags) {
205 assert(_body && _shape);
205 if (flags & Simulation::DIRTY_POSITION) {206 if (flags & Simulation::DIRTY_POSITION) {
206 btTransform worldTrans = _body->getWorldTransform();207 btTransform worldTrans = _body->getWorldTransform();
207 btVector3 newPosition = glmToBullet(getObjectPosition());208 btVector3 newPosition = glmToBullet(getObjectPosition());
@@ -282,6 +283,7 @@ void ObjectMotionState::handleEasyChanges(uint32_t& flags) { · 74 unmodified lines
282}283}
283 284
284bool ObjectMotionState::handleHardAndEasyChanges(uint32_t& flags, PhysicsEngine* engine) {285bool ObjectMotionState::handleHardAndEasyChanges(uint32_t& flags, PhysicsEngine* engine) {
286 assert(_body && _shape);
285 if (flags & Simulation::DIRTY_SHAPE) {287 if (flags & Simulation::DIRTY_SHAPE) {
286 // make sure the new shape is valid288 // make sure the new shape is valid
287 if (!isReadyToComputeShape()) {289 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