Skip to content

Protect against clusterless FlowElements in moment getter

This adds protection against exceptions when attempting to retrieve cluster moments for FlowElements which have no associated neutral objects (clusters). I'm not aware of this ever being a problem in practice, but the potential for this to throw an exception was noticed in the discussion around ATLASG-1654, so I'm pre-empting any possible future issues now. Note that this does not actually solve the aforementioned Jira issue, which is due to an unrelated problem.

The only change to the behavior is that FEHelpers::getClusterMoment(...) will now not throw an exception if the input FlowElement has no associated neutral objects. In this case, if the FlowElement has already had the relevant moment decorated onto it directly, it will correctly provide that value and return true. If not, it will safely return false.

T0 output will be unaffected, so this can go into 22.0 as well.

Tagging @delsart, @mhodgkin, @sawyer, @schaarsc for their awareness.

Merge request reports