[5.8] Null FPhysicsActorHandle crash in FBodyInstance::InitDynamicProperties_AssumesLocked when shape creation fails

Found after updating a project from 5.7 to 5.8 @ CL54667078. Also present in //UE5/Main. Requires p.Chaos.EnableAsyncInitBody=true. Same content ran fine in 5.7.

Crash

FChaosEngineInterface::SetSleepThresholdMultiplier_AssumesLocked ChaosEngineInterface.cpp:1261

FBodyInstance::InitDynamicProperties_AssumesLocked BodyInstance.cpp:4710

TInitBodiesHelperBase<>::InitBodies BodyInstance.cpp:1704

Cause

When CreateShapes_AssumesLocked returns bInitFail (NumShapes == 0), the failure path (BodyInstance.cpp:1577) releases the actor handle and nulls Instance->BodySetup, but leaves the instance in Bodies[]. InitBodies() then calls InitDynamicProperties_AssumesLocked() on it (:1704).

UE 5.7 caught this with if (!BodySetup.IsValid()) return;. 5.8 uses if (!GetBodySetup()) return;, and GetBodySetup() (:1381) now prefers GetAsyncPhysicsCreationInputs()->ResolvedBodySetup, which is never reset on the failure path — so it returns a live UBodySetup and the guard passes.

FPhysicsInterface::IsDynamic() is !IsStatic(), and IsStatic() returns false for an invalid handle, so it returns true for nullptr. SetSleepThresholdMultiplier_AssumesLocked then dereferences null.

Suggested fix

void FBodyInstance::InitDynamicProperties_AssumesLocked()

{

+ // Shape creation may have failed and released the actor handle, leaving this

+ // instance in Bodies[]. IsDynamic() returns true for a null handle.

+ if (!FPhysicsInterface::IsValid(GetPhysicsActor()))

+ {

+ return;

+ }

+

UBodySetup\* ResolvedSetup \= GetBodySetup();

if (!ResolvedSetup)

{

  // This may be invalid following an undo if the BodySetup was a transient object

  return;

}

Note on our content

Our data is also wrong here — a component requesting collision from a mesh with no collision geometry is meaningless, and we’re fixing that separately. But the engine already decided to fail that body and released its handle, so it shouldn’t then walk into a null dereference. 5.7 tolerated the same content silently.

[Attachment Removed]

Steps to Reproduce
Movable primitive, Collision Enabled other than QueryOnly, BodySetup yielding zero shapes — e.g. empty AggGeom with DefaultShapeComplexity=CTF_UseSimpleAsComplex, which suppresses trimesh cooking (BodySetup.cpp:326).

[Attachment Removed]

Hi Filip,

Thank you for the ticket, and we’ve had reports of this from elsewhere as a regression in 5.8. I’ll get a Bugfix Jira created today and send you the ticket.

Best

Geoff Stacey

Developer Relations

EPIC Games

[Attachment Removed]

Thanks!

[Attachment Removed]

Hi Filip, the bug is posted on https://issues.unrealengine.com/issue/UE-389735, and you will be able to follow its progress there. I’d expect this to be fixed within the next few weeks given what it is.

Best

Geoff

[Attachment Removed]