Hello! I've recently come across a crash in the Unreal 5.5 substance plugin, 100% reproducible
- Create a new Substance Graph Instance WITHOUT creating a material instance
- Open the Graph instance and disable any texture output parameter
- 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!