Crash when exporting static mesh actor to FBX (Array index out of bounds)

I set the Forced LOD Model on the mesh component > 1, then tried to export, this is what causes the crash. Here is my suggested fix, we just don’t use Git or I’d do a PR:

In the else() branch of FFbxExporter::ExportStaticMesh(), replace the LODIndex definition with the following to clamp it to a valid value:

const int32 LODIndex = (StaticMeshComponent->ForcedLodModel > 0

? FMath::Min(StaticMesh->GetNumLODs(), StaticMeshComponent->ForcedLodModel) - 1

: /* auto-select*/ 0);

This crash was encountered when trying to export an entire level, and sometimes artists will mass-set the Forced LOD Model on many components to cause this.

Thanks,

-Nick

Steps to Reproduce

  1. Open TestMap
  2. Select SM_SkySphere in the outliner
  3. File --> Export Selected…
  4. Keep the default options, save the FBX
  5. Crash

Hi Nick,

Thanks for the detailed report and fix proposal.

I opened a ticket to track you issue: UE-274320. We will try to fix this as soon as we can.

Note that it may take some days before the link becomes operational.

Regards,

Jean-Luc