The precondition in Bond::getOtherAtomIdx() is redundant (#9092)

This commit is contained in:
Ricardo Rodriguez
2026-02-06 10:09:23 -05:00
committed by GitHub
parent 36f061efb1
commit 813cd85ecc

View File

@@ -78,15 +78,14 @@ void Bond::setOwningMol(ROMol *other) {
}
unsigned int Bond::getOtherAtomIdx(const unsigned int thisIdx) const {
PRECONDITION(d_beginAtomIdx == thisIdx || d_endAtomIdx == thisIdx,
"bad index");
if (d_beginAtomIdx == thisIdx) {
return d_endAtomIdx;
} else if (d_endAtomIdx == thisIdx) {
return d_beginAtomIdx;
}
// we cannot actually get down here
return 0;
// This "precondition" would check exactly the same that is checked
// above, but no need to be redundant, so just throw.
POSTCONDITION(false, "bad index");
}
void Bond::setBeginAtomIdx(unsigned int what) {