Commit cdb88ebd authored by Evgeniy Fominov's avatar Evgeniy Fominov
Browse files

safety check for null pointers

parent d4235856
...@@ -37,10 +37,11 @@ GazeboGraspFix::GazeboGraspFix(physics::ModelPtr _model) ...@@ -37,10 +37,11 @@ GazeboGraspFix::GazeboGraspFix(physics::ModelPtr _model)
GazeboGraspFix::~GazeboGraspFix() GazeboGraspFix::~GazeboGraspFix()
{ {
// Release filter to make it safe to reload the model with plugin // Release filter to make it safe to reload the model with plugin
if (!filter_name.empty()) if (!filter_name.empty() && this->world)
{ {
physics::PhysicsEnginePtr physics = GetPhysics(this->world); physics::PhysicsEnginePtr physics = GetPhysics(this->world);
physics::ContactManager *contactManager = physics->GetContactManager(); physics::ContactManager *contactManager = physics->GetContactManager();
if (contactManager)
contactManager->RemoveFilter(filter_name); contactManager->RemoveFilter(filter_name);
} }
this->update_connection.reset(); this->update_connection.reset();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment