Skip to content

Remove repeated checking of same value#1327

Closed
rcywongaa wants to merge 1 commit intomoveit:mainfrom
rcywongaa:patch-1
Closed

Remove repeated checking of same value#1327
rcywongaa wants to merge 1 commit intomoveit:mainfrom
rcywongaa:patch-1

Conversation

@rcywongaa
Copy link
Copy Markdown
Contributor

@rcywongaa rcywongaa commented Jun 7, 2022

Description

While the repeated checking of the same value seems likely wrong, I wonder if this function is doing what it claims. Seems to be checking whether a scalar is within bounds of a vector[3].

Checklist

  • Required by CI: Code is auto formatted using clang-format
  • Extend the tutorials / documentation reference
  • Document API changes relevant to the user in the MIGRATION.md notes
  • Create tests, which fail without this PR reference
  • Include a screenshot if changing a GUI
  • While waiting for someone to review your request, please help review another open pull request to support the maintainers

@rcywongaa rcywongaa marked this pull request as ready for review June 7, 2022 21:33
Comment on lines +273 to +276
if (values[0] < bounds[0].min_position_ - margin || values[0] > bounds[0].max_position_ + margin)
return false;
else
return true;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there any guarantee that values and bounds have at least one value? This looks like a segfault in waiting.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does it also seem like it is more likely that the intent was to use the index i somehow than to check the first element 3 times?

@rcywongaa
Copy link
Copy Markdown
Contributor Author

I'll close this for now until I clarify what this function is supposed to do...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants