Skip to main content
Participant
June 24, 2025

[Crash] Substance Unreal 5.5 Plugin crashes when removing a texture input (fix included in thread)

  • June 24, 2025
  • 0 replies
  • 103 views

Hello! I've recently come across a crash in the Unreal 5.5 substance plugin, 100% reproducible

 

  1. Create a new Substance Graph Instance WITHOUT creating a material instance
  2. Open the Graph instance and disable any texture output parameter
  3. Unreal editor will crash due to a nullptr reference

 

I was looking through the plugin source code and the fix is very simple 

Inside the file Plugins/External/Marketplace/Substance/Source/SubstanceEditor/Private/SSubstanceEditorPanel.cpp line 786 Graph->ConstantCreatedMaterial is not being checked before being accessed

 

auto mat = Graph->ConstantCreatedMaterial;
for (int i = 0; i < mat->TextureParameterValues.Num(); i++)
{
	if (mat->TextureParameterValues[i].ParameterInfo == OutputData->ParamInfo)
	{
		mat->TextureParameterValues.RemoveAt(i);
		break;
	}
}
mat->PostEditChange();


Should be wrapped in a null check i.e

auto mat = Graph->ConstantCreatedMaterial;
if (mat)
{
	for (int i = 0; i < mat->TextureParameterValues.Num(); i++)
	{
		if (mat->TextureParameterValues[i].ParameterInfo == OutputData->ParamInfo)
		{
			mat->TextureParameterValues.RemoveAt(i);
			break;
		}
	}
	mat->PostEditChange();
}



I've fixed this locally but hope this can be fixed for everybody!