FBX Import crashes when not all materials are used

Hi,
I was trying to import a level we made , but the engine was crashing in Engine\Source\Editor\UnrealEd\Private\Fbx\FbxStaticMeshImport.cpp:1619 because FoundMaterialIndex==-1.

The reason for this is that one of our 3d objects has a material map of 5 materials, but it’s using only the 4th material, so I think the code is getting confused.

I’m using 4.14.2 release.

The reason it crashes is because the current code doesn’t have a safe option to capture the case where FoundMaterialIndex==-1.

In the diff attached I just checked FoundMaterialIndex>=0 before the assignment. From my tests the import doesn’t crash anymore and the result is a correct mesh. Can some dev look at it and see if it’s worth check-in to main repo?
link text