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

Modified: code/gazebo/trunk/server/physics/ode/ODEUniversalJoint.cc
===================================================================
--- code/gazebo/trunk/server/physics/ode/ODEUniversalJoint.cc   2010-04-26 
18:09:36 UTC (rev 8626)
+++ code/gazebo/trunk/server/physics/ode/ODEUniversalJoint.cc   2010-04-26 
18:09:46 UTC (rev 8627)
@@ -60,8 +60,8 @@
 void ODEUniversalJoint::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);
 
   dJointSetUniversalAnchor( this->jointId, anchor.x, anchor.y, anchor.z );
   this->physics->UnlockMutex();
@@ -89,8 +89,8 @@
 {
   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)
     dJointSetUniversalAxis1( this->jointId, axis.x, axis.y, axis.z );
@@ -144,8 +144,8 @@
 void ODEUniversalJoint::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)
     dJointAddUniversalTorques( this->jointId, torque, 0);
   else


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