yoshinoToylogic / bulletsharp

Automatically exported from code.google.com/p/bulletsharp
MIT License
0 stars 0 forks source link

No return of a possible Nullpointer in BulletWorldImporter.cpp #10

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Several get<Object> -functions in the BulletWorldImporter.cpp(Line ~345) do not 
pass a possible Nullpointer when the object was not found, resulting in 
Accesviolation-Exceptions.

I changed only the thing i need from:
RigidBody^ Serialize::BulletWorldImporter::GetRigidBodyByName(String^ name)
{
    const char* nameTemp = StringConv::ManagedToUnmanaged(name);

    RigidBody^ ret = gcnew RigidBody(_importer->getRigidBodyByName(nameTemp));

    StringConv::UnmanagedToManaged(nameTemp);
    return ret;
}
To:
RigidBody^ Serialize::BulletWorldImporter::GetRigidBodyByName(String^ name)
{
    const char* nameTemp = StringConv::ManagedToUnmanaged(name);

    btRigidBody* btRTemp = _importer->getRigidBodyByName(nameTemp);

    StringConv::UnmanagedToManaged(nameTemp);

    if (btRTemp != nullptr)
    {
        return gcnew RigidBody(btRTemp);
    }
    else
    {
        return nullptr;
    }
}

Original issue reported on code.google.com by am...@web.de on 27 Jun 2010 at 9:54

GoogleCodeExporter commented 8 years ago
Yep, that's something I haven't paid much attention to yet. I'll try to fix it 
soon.

Original comment by andres.traks on 29 Jun 2010 at 11:35

GoogleCodeExporter commented 8 years ago
This should be fixed by now, but there may be other such cases that I've missed.

Original comment by andres.traks on 29 Aug 2010 at 12:31