Commit 248bf676 authored by Sankhesh Jhaveri's avatar Sankhesh Jhaveri

Issue error if vtkAlgorithm::GetInputConnection called on wrong port

The original logic was issuing a warning if querying a connection that
was outside the range of input connections to the port. This led to
warnings in application code that was querying if a particular algorithm
had input connections yet.

The new logic issues an error if the port in reference, is outside the
normal range of input ports for the algorithm but silently returns a
nullptr when the connection index is outside the range of connection
indices for the port i.e. no more warning when no input is provided.
parent b2e6b0a2
......@@ -1413,14 +1413,16 @@ vtkExecutive* vtkAlgorithm::GetInputExecutive(int port, int index)
//----------------------------------------------------------------------------
vtkAlgorithmOutput* vtkAlgorithm::GetInputConnection(int port, int index)
{
if(index < 0 || index >= this->GetNumberOfInputConnections(port))
if(port < 0 || port >= this->GetNumberOfInputPorts())
{
vtkErrorMacro("Attempt to get connection index " << index
<< " for input port " << port << ", for an algorithm with "
<< this->GetNumberOfInputPorts()
<< " ports.");
return nullptr;
}
if (index < 0 || index >= this->GetNumberOfInputConnections(port))
{
#if !defined NDEBUG
vtkWarningMacro("Attempt to get connection index " << index
<< " for input port " << port << ", which has "
<< this->GetNumberOfInputConnections(port)
<< " connections.");
#endif
return nullptr;
}
if(vtkInformation* info =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment