Skip to content

Commit

Permalink
Fix CodeQL issues
Browse files Browse the repository at this point in the history
Signed-off-by: Geoff Hutchison <[email protected]>
  • Loading branch information
ghutchis committed Oct 10, 2023
1 parent 85b69a8 commit c4cbdc1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions avogadro/qtplugins/aligntool/aligntool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,12 @@ bool AlignTool::handleCommand(const QString& command,
if (command == "centerAtom") {
if (options.contains("id")) {
Index atomIndex = options["id"].toInt();
if (atomIndex >= 0 && atomIndex < m_molecule->atomCount())
if (atomIndex < m_molecule->atomCount())
shiftAtomToOrigin(atomIndex);
return true;
} else if (options.contains("index")) {
Index atomIndex = options["index"].toInt();
if (atomIndex >= 0 && atomIndex < m_molecule->atomCount())
if (atomIndex < m_molecule->atomCount())
shiftAtomToOrigin(atomIndex);
return true;
}
Expand All @@ -344,19 +344,21 @@ bool AlignTool::handleCommand(const QString& command,
if (axis >= 0 && axis < 3) {
if (options.contains("id")) {
Index atomIndex = options["id"].toInt();
if (atomIndex >= 0 && atomIndex < m_molecule->atomCount())
if (atomIndex < m_molecule->atomCount())
alignAtomToAxis(atomIndex, axis);
return true;
} else if (options.contains("index")) {
Index atomIndex = options["index"].toInt();
if (atomIndex >= 0 && atomIndex < m_molecule->atomCount())
if (atomIndex < m_molecule->atomCount())
alignAtomToAxis(atomIndex, axis);
return true;
}
}

return true;
return false; // invalid options
}

return true; // nothing to handle
}

} // namespace Avogadro::QtPlugins

1 comment on commit c4cbdc1

@github-actions
Copy link

Choose a reason for hiding this comment

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

ERROR: clang-format-diff detected formatting issues. See the artifact for a patch or run clang-format on your branch.

Please sign in to comment.