Skip to content

Commit

Permalink
Add null check in godot result callback
Browse files Browse the repository at this point in the history
  • Loading branch information
muiroc committed Sep 16, 2018
1 parent 9af72f0 commit 23a61c7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions modules/bullet/godot_result_callbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,11 @@ bool GodotClosestConvexResultCallback::needsCollision(btBroadphaseProxy *proxy0)
}

btScalar GodotClosestConvexResultCallback::addSingleResult(btCollisionWorld::LocalConvexResult &convexResult, bool normalInWorldSpace) {
btScalar res = btCollisionWorld::ClosestConvexResultCallback::addSingleResult(convexResult, normalInWorldSpace);
m_shapeId = convexResult.m_localShapeInfo->m_triangleIndex; // "m_triangleIndex" Is a odd name but contains the compound shape ID
return res;
if (convexResult.m_localShapeInfo)
m_shapeId = convexResult.m_localShapeInfo->m_triangleIndex; // "m_triangleIndex" Is a odd name but contains the compound shape ID
else
m_shapeId = 0;
return btCollisionWorld::ClosestConvexResultCallback::addSingleResult(convexResult, normalInWorldSpace);
}

bool GodotAllContactResultCallback::needsCollision(btBroadphaseProxy *proxy0) const {
Expand Down

0 comments on commit 23a61c7

Please sign in to comment.