Revision: 8628
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8628&view=rev
Author:   hsujohnhsu
Date:     2010-04-26 18:10:10 +0000 (Mon, 26 Apr 2010)

Log Message:
-----------
check body befor enabling, in case it's the world

Modified Paths:
--------------
    code/gazebo/trunk/server/physics/ode/ODEHingeJoint.cc

Modified: code/gazebo/trunk/server/physics/ode/ODEHingeJoint.cc
===================================================================
--- code/gazebo/trunk/server/physics/ode/ODEHingeJoint.cc       2010-04-26 
18:09:46 UTC (rev 8627)
+++ code/gazebo/trunk/server/physics/ode/ODEHingeJoint.cc       2010-04-26 
18:10:10 UTC (rev 8628)
@@ -76,8 +76,8 @@
 void ODEHingeJoint::SetAnchor( int /*index*/, const Vector3 &anchor )
 {
   this->physics->LockMutex();
-  this->body1->SetEnabled(true);
-  this->body2->SetEnabled(true);
+  if (this->body1) this->body1->SetEnabled(true);
+  if (this->body2) this->body2->SetEnabled(true);
 
   dJointSetHingeAnchor( this->jointId, anchor.x, anchor.y, anchor.z );
   this->physics->UnlockMutex();
@@ -102,8 +102,8 @@
 void ODEHingeJoint::SetAxis( int /*index*/, const Vector3 &axis )
 {
   this->physics->LockMutex();
-  this->body1->SetEnabled(true);
-  this->body2->SetEnabled(true);
+  if (this->body1) this->body1->SetEnabled(true);
+  if (this->body2) this->body2->SetEnabled(true);
 
   dJointSetHingeAxis( this->jointId, axis.x, axis.y, axis.z );
   this->physics->UnlockMutex();
@@ -157,8 +157,8 @@
 void ODEHingeJoint::SetForce(int /*index*/, double torque)
 {
   this->physics->LockMutex();
-  this->body1->SetEnabled(true);
-  this->body2->SetEnabled(true);
+  if (this->body1) this->body1->SetEnabled(true);
+  if (this->body2) this->body2->SetEnabled(true);
   dJointAddHingeTorque( this->jointId, torque );
   this->physics->UnlockMutex();
 }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
_______________________________________________
Playerstage-commit mailing list
Playerstage-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to