Skip to content

Commit

Permalink
Add null checks to UiPin methods (#2147)
Browse files Browse the repository at this point in the history
This changelist adds null checks to the UiPin::addConnection and UiPin::deleteConnection methods in the Graph Editor, providing additional protection against crashes.
  • Loading branch information
jstone-lucasfilm authored Dec 16, 2024
1 parent d4ee66c commit 31ca71b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion source/MaterialXGraphEditor/UiNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ class UiPin

void addConnection(UiPinPtr pin)
{
if (!pin)
{
return;
}

for (size_t i = 0; i < _connections.size(); i++)
{
if (_connections[i]->_pinId == pin->_pinId)
Expand All @@ -97,6 +102,11 @@ class UiPin

void deleteConnection(UiPinPtr pin)
{
if (!pin)
{
return;
}

for (size_t i = 0; i < _connections.size(); i++)
{
if (_connections[i]->_pinId == pin->_pinId)
Expand All @@ -115,7 +125,6 @@ class UiPin
{
pin->setConnected(false);
}
return;
}

const std::vector<UiPinPtr>& getConnections()
Expand Down

0 comments on commit 31ca71b

Please sign in to comment.