Crash on SSkeletonTree due to missing ActorFactory

There is a crash at the beginning of the method:

FDisplayedAttachedAssetInfo::GenerateWidgetForNameColumn(...)
{
	UActorFactory* ActorFactory = FActorFactoryAssetProxy::GetFactoryForAssetObject( Asset );
	const FSlateBrush* IconBrush = FSlateIconFinder::FindIconBrushForClass(ActorFactory->GetDefaultActorClass(FAssetData()));

The crash happens when the pointer ActorFactory is NULL, as is the case when there is no ActorFactory associated with the Asset.

I can currently circumvent this by defining an ActorFactory, but that is extra code which, in my case, makes little sense, as the relevant Asset Type should not be instanceable by drag-and-dropping into the Level Editor.

A possible solution would be to use a default Icon, or no Icon at all, if no ActorFactory can be found:

UActorFactory* ActorFactory = FActorFactoryAssetProxy::GetFactoryForAssetObject( Asset );
const FSlateBrush* IconBrush = ActorFactory ?
	FSlateIconFinder::FindIconBrushForClass(ActorFactory->GetDefaultActorClass(FAssetData())) :
	FSlateIcon::FSlateIcon().GetOptionalIcon();

I am not sure if this behaviour is intentional, though.

I have seen this problem since UE4.12.

Hey Muelas-

Can you explain how you’re using this code? If possible, please provide reproduction steps that cause the crash. Additionally, if you could provide your callstack and log files from the crash, the extra information will also help investigate the issue.

Hi. A simple repro case is:

  • Open a SkeletalMesh in Persona/SkeletalMeshEditor.
  • Switch to Skeleton tab.
  • From the ContentBrowser, drag-and-drop a Material onto the Skeleton tree view.
  • The editor crashes.

The crash is a access violation (this was nullptr).
It crashes in

UActorFactory::GetDefaultActorClass

when called from

FDisplayedAttachedAssetInfo::GenerateWidgetForNameColumn

with ActorFactory being nullptr.

This specific case is a bit dumb, but it reproduces the behaviour without me having to post code I have no permission to disclose (I could try to replicate the code removing all sensitive information, but it would take some time).

I am attaching the call stack as it is a bit long to copy-paste link text

To give some context, the Asset class in question works in a Component type that is to be attached to a SkeletalMeshComponent (does modifications on bone poses).
Artists need to be able to preview the effects on Persona, and the way I achieve this is by setting up the Asset as a Preview Asset on the relevant SkeletalMesh: Persona then automatically instances an appropriate Component with the Asset, and attaches it to the preview SkeletalMesh.

The problem comes from the fact that preview assets are displayed on the Skeleton Tree, with an accompanying Icon. Since the type of asset that I am using has no associated ActorFactory (because it makes no sense to create an actor from it, as it needs to be attached to a SkeletalMesh), and FDisplayedAttachedAssetInfo::GenerateWidgetForNameColumn requests an ActorFactory to determine what Icon to use, it crashes when dereferencing the pointer to the non-existent ActorFactory.

I think an appropriate solution would be to use a default Icon (or no Icon at all) if no ActorFactory is found.

Thanks

Hey Muelas-

Thank you for the repro steps. I have reproduced this issue and logged a report for it here Unreal Engine Issues and Bug Tracker (UE-41389) . You can track the report’s status as the issue is reviewed by our development staff. Please be aware that this issue may not be prioritized or fixed soon.

Cheers

Thanks a lot!