summaryrefslogtreecommitdiff
path: root/modules/bullet
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-06-22 10:46:39 +0200
committerGitHub <noreply@github.com>2020-06-22 10:46:39 +0200
commit10d2fa4210f9287af413d38c9ce8baf0b343ba20 (patch)
tree008f5a35ceff560487bfe6d3201e74bb757d94be /modules/bullet
parent492625db28aaef7be670488f10f1f1053c8620ad (diff)
parent8b0232bf295c924c157b30f78c9b991fb211dd73 (diff)
Merge pull request #39747 from nekomatata/fix-crash-space-query
Fix crashes with invalid shapes in BulletPhysicsDirectSpaceState queries
Diffstat (limited to 'modules/bullet')
-rw-r--r--modules/bullet/space_bullet.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp
index 1b6ccbcef4..cfe8cd5322 100644
--- a/modules/bullet/space_bullet.cpp
+++ b/modules/bullet/space_bullet.cpp
@@ -123,6 +123,7 @@ int BulletPhysicsDirectSpaceState::intersect_shape(const RID &p_shape, const Tra
}
ShapeBullet *shape = space->get_physics_server()->get_shape_owner()->getornull(p_shape);
+ ERR_FAIL_COND_V(!shape, 0);
btCollisionShape *btShape = shape->create_bt_shape(p_xform.basis.get_scale_abs(), p_margin);
if (!btShape->isConvex()) {
@@ -162,6 +163,7 @@ bool BulletPhysicsDirectSpaceState::cast_motion(const RID &p_shape, const Transf
}
ShapeBullet *shape = space->get_physics_server()->get_shape_owner()->getornull(p_shape);
+ ERR_FAIL_COND_V(!shape, false);
btCollisionShape *btShape = shape->create_bt_shape(p_xform.basis.get_scale(), p_margin);
if (!btShape->isConvex()) {
@@ -215,6 +217,7 @@ bool BulletPhysicsDirectSpaceState::collide_shape(RID p_shape, const Transform &
}
ShapeBullet *shape = space->get_physics_server()->get_shape_owner()->getornull(p_shape);
+ ERR_FAIL_COND_V(!shape, false);
btCollisionShape *btShape = shape->create_bt_shape(p_shape_xform.basis.get_scale_abs(), p_margin);
if (!btShape->isConvex()) {
@@ -246,6 +249,7 @@ bool BulletPhysicsDirectSpaceState::collide_shape(RID p_shape, const Transform &
bool BulletPhysicsDirectSpaceState::rest_info(RID p_shape, const Transform &p_shape_xform, float p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) {
ShapeBullet *shape = space->get_physics_server()->get_shape_owner()->getornull(p_shape);
+ ERR_FAIL_COND_V(!shape, false);
btCollisionShape *btShape = shape->create_bt_shape(p_shape_xform.basis.get_scale_abs(), p_margin);
if (!btShape->isConvex()) {