Revision: 8624
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8624&view=rev
Author:   hsujohnhsu
Date:     2010-04-26 18:09:09 +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/ODEHinge2Joint.cc

Modified: code/gazebo/trunk/server/physics/ode/ODEHinge2Joint.cc
===================================================================
--- code/gazebo/trunk/server/physics/ode/ODEHinge2Joint.cc      2010-04-26 
13:50:18 UTC (rev 8623)
+++ code/gazebo/trunk/server/physics/ode/ODEHinge2Joint.cc      2010-04-26 
18:09:09 UTC (rev 8624)
@@ -91,8 +91,8 @@
 void ODEHinge2Joint::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);
   dJointSetHinge2Anchor( this->jointId, anchor.x, anchor.y, anchor.z );
   this->physics->UnlockMutex();
 }
@@ -102,8 +102,8 @@
 void ODEHinge2Joint::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);
 
   if (index == 0)
     dJointSetHinge2Axis1( this->jointId, axis.x, axis.y, axis.z );
@@ -193,8 +193,8 @@
 void ODEHinge2Joint::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);
 
   if (index == 0)
     dJointAddHinge2Torques(this->jointId, torque, 0);


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