Merge pull request #5206 from bytes-of-pi/graphmodel_fixgetnodesfromgraph
Prevent GetNodesFromGraphNodeIDs() from adding null pointers to the l…
This commit is contained in:
@@ -698,7 +698,10 @@ namespace GraphModelIntegration
|
||||
GraphModel::NodePtrList nodeList;
|
||||
for (auto nodeId : nodeIds)
|
||||
{
|
||||
nodeList.push_back(m_elementMap.Find<GraphModel::Node>(nodeId));
|
||||
if (GraphModel::NodePtr nodePtr = m_elementMap.Find<GraphModel::Node>(nodeId))
|
||||
{
|
||||
nodeList.push_back(nodePtr);
|
||||
}
|
||||
}
|
||||
|
||||
return nodeList;
|
||||
|
||||
@@ -173,16 +173,11 @@ namespace GraphModelIntegrationTest
|
||||
};
|
||||
GraphModel::NodePtrList retrievedNodes;
|
||||
GraphModelIntegration::GraphControllerRequestBus::EventResult(retrievedNodes, m_sceneId, &GraphModelIntegration::GraphControllerRequests::GetNodesFromGraphNodeIds, nodeIds);
|
||||
EXPECT_EQ(nodeIds.size(), retrievedNodes.size());
|
||||
// Test that only one node was found.
|
||||
EXPECT_EQ(retrievedNodes.size(), 1);
|
||||
|
||||
// Test the first node in the list should be our valid test node
|
||||
EXPECT_EQ(retrievedNodes[0], testNode);
|
||||
|
||||
// Test the second node should be a nullptr since it was an invalid NodeId
|
||||
EXPECT_EQ(retrievedNodes[1], nullptr);
|
||||
|
||||
// Test the third node should also be a nullptr since it was a valid NodeId but one that doesn't exist in the scene
|
||||
EXPECT_EQ(retrievedNodes[2], nullptr);
|
||||
}
|
||||
|
||||
TEST_F(GraphModelIntegrationTests, ExtendableSlotsWithDifferentMinimumValues)
|
||||
|
||||
Reference in New Issue
Block a user