Skip to content

Commit

Permalink
Add null checks to UiPin methods
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 committed Dec 15, 2024
1 parent d4ee66c commit a1bf6e6
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 a1bf6e6

Please sign in to comment.