Jump to content

Unigine::Object::getBodyRigid always returns NULL?


photo

Recommended Posts

We are having some trouble with the Unigine::Object::getBodyRigid function in the C++ API in 2.2.1, it always seems to return NULL even if there is a valid body. Seems like in UniginePhysics.cpp the condition is inverted, returning a BodyRigidInterface when input is NULL and returning NULL when input is a valid BodyRigid:

BodyRigidPtr api(::BodyRigid *arg) { return BodyRigidPtr(arg == NULL ? new BodyRigidInterface(arg) : NULL ); }
Link to comment
  • 2 months later...

In the same file, there are 2 getters that do not have the 'arg != NULL' test :

BodyPtr api(const ::Body *arg) { return BodyPtr(new BodyInterface(const_cast< ::Body* >(arg))); }
BodyRigidPtr api(const ::BodyRigid *arg) { return BodyRigidPtr(new BodyRigidInterface(const_cast< ::BodyRigid* >(arg))); }

When arg is NULL, we still receive a valid Interface, which will crash at the first function call.

This is just to be sure it will also be fixed in the next release.

Link to comment
×
×
  • Create New...