Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong component comparison in SpecularReflationPos.Cor. #19262

Merged
merged 2 commits into from Mar 30, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 9 additions & 9 deletions Framework/Algorithms/src/SpecularReflectionPositionCorrect.cpp
Expand Up @@ -39,17 +39,17 @@ getParentComponent(IComponent_const_sptr &currentComponent) {
* @return True only if all detectors have the same immediate parent.
*/
bool hasCommonParent(const std::vector<IDetector_const_sptr> &detectors) {
bool sameParentComponent = true;
auto lastParentComponent = detectors[0]->getParent()->getComponentID();
auto firstParent = detectors[0]->getParent();
if (!firstParent)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nullptr check looks to make things safer. Was this causing things to fail?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OwenArnold Yes, the OFFSPECReflRedOneAutoPolarizationCorrection system test.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

return false;
for (size_t i = 1; i < detectors.size(); ++i) {
auto currentParentComponent = detectors[i]->getParent()->getComponentID();
if (lastParentComponent != currentParentComponent) {
sameParentComponent = false; // Parent components are different.
break;
}
lastParentComponent = currentParentComponent;
auto parent = detectors[i]->getParent();
if (!parent)
return false;
if (firstParent->getComponentID() != parent->getComponentID())
return false;
}
return sameParentComponent;
return true;
}
}
// Register the algorithm into the AlgorithmFactory
Expand Down