summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-09-17 11:09:06 +0200
committerGitHub <noreply@github.com>2018-09-17 11:09:06 +0200
commitdbee7856e3d59b5ddce1ee0f424dc8a14cf4226f (patch)
tree3ff9987ee0f2f702939e95fbaaa97ed0ed79e771 /modules
parent6938b6e2f8351438556c2df4cee9cd25a160fecd (diff)
parent23a61c7342d7e2c3a3a234b4df130d02cdb02267 (diff)
Merge pull request #22157 from muiroc/fix_cast_crash
Add null check in godot result callback
Diffstat (limited to 'modules')
-rw-r--r--modules/bullet/godot_result_callbacks.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/bullet/godot_result_callbacks.cpp b/modules/bullet/godot_result_callbacks.cpp
index 08d8b8c6f6..3b44ab838e 100644
--- a/modules/bullet/godot_result_callbacks.cpp
+++ b/modules/bullet/godot_result_callbacks.cpp
@@ -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 {