Skip to content

Commit

Permalink
Add null check in getShaderNodes (#2228)
Browse files Browse the repository at this point in the history
This changelist adds a missing null check in getShaderNodes, handling the edge case of an invalid output string.  Previously, this edge case would trigger a crash in MaterialXCore, and now it correctly generates validation warnings and proceeds.
  • Loading branch information
jstone-lucasfilm authored Feb 14, 2025
1 parent 7fc041d commit e13344b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion source/MaterialXCore/Material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ vector<NodePtr> getShaderNodes(NodePtr materialNode, const string& nodeType, con
vector<OutputPtr> outputs;
if (input->hasOutputString())
{
outputs.push_back(nodeGraph->getOutput(input->getOutputString()));
OutputPtr connectedOutput = nodeGraph->getOutput(input->getOutputString());
if (connectedOutput)
{
outputs.push_back(connectedOutput);
}
}
else
{
Expand Down

0 comments on commit e13344b

Please sign in to comment.