From 4504d0ae96a274951742ec50fa0749f6de8a0499 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Tue, 16 Dec 2025 18:22:26 -0600 Subject: [PATCH] Fix compute distance crash if no closest point param is defined. --- Source/Engine/Physics/PhysX/PhysicsBackendPhysX.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Engine/Physics/PhysX/PhysicsBackendPhysX.cpp b/Source/Engine/Physics/PhysX/PhysicsBackendPhysX.cpp index 18929ab73..3edfaa0c6 100644 --- a/Source/Engine/Physics/PhysX/PhysicsBackendPhysX.cpp +++ b/Source/Engine/Physics/PhysX/PhysicsBackendPhysX.cpp @@ -2787,7 +2787,8 @@ float PhysicsBackend::ComputeShapeSqrDistanceToPoint(void* shape, const Vector3& #if USE_LARGE_WORLDS PxVec3 closestPointPx; float result = PxGeometryQuery::pointDistance(C2P(point), shapePhysX->getGeometry(), trans, &closestPointPx); - *closestPoint = P2C(closestPointPx); + if (closestPoint) + *closestPoint = P2C(closestPointPx); return result; #else return PxGeometryQuery::pointDistance(C2P(point), shapePhysX->getGeometry(), trans, (PxVec3*)closestPoint);