CPACSRotor::GetNominalRotationsPerMinute() returns a boost::optional<double>&. The return value is dereferenced in several places without first checking if the boost::optional holds a value:
I suggest shadowing GetNominalRotationsPerMinute in CCPACSRotor with a wrapper function that returns a double by calling generated::CPACSRotor::GetNominalRotationsPerMinute().get_value_or(0.); This makes sure that the default value for this optional is defined only in one place in the code.
CPACSRotor::GetNominalRotationsPerMinute()
returns aboost::optional<double>&
. The return value is dereferenced in several places without first checking if theboost::optional
holds a value:https://github.com/DLR-SC/tigl/blob/ede4575ff42c8f7359e940fa2b92c2e48050862e/src/rotor/CCPACSRotor.cpp#L220
https://github.com/DLR-SC/tigl/blob/ede4575ff42c8f7359e940fa2b92c2e48050862e/src/rotor/CCPACSRotorBladeAttachment.cpp#L84
https://github.com/DLR-SC/tigl/blob/ede4575ff42c8f7359e940fa2b92c2e48050862e/src/rotor/CTiglAttachedRotorBlade.cpp#L216
Suggestion:
I suggest shadowing
GetNominalRotationsPerMinute
inCCPACSRotor
with a wrapper function that returns a double by callinggenerated::CPACSRotor::GetNominalRotationsPerMinute().get_value_or(0.);
This makes sure that the default value for this optional is defined only in one place in the code.