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

Prevent creation of spurious <plugin> elements when saving worlds #1192

Merged
merged 1 commit into from
Nov 11, 2021

Conversation

azeey
Copy link
Contributor

@azeey azeey commented Nov 11, 2021

🦟 Bug fix

Summary

Spurious <plugin> elements were created when saving worlds because sdf::Element::GetElement was used to check if a <plugin> child element exists. However this function always creates a new element if the element does not exist instead of returning a nullptr. The solution is to use sdf::Element::FindElement instead.

Checklist

  • Signed all commits for DCO
  • Added tests
  • [ ] Updated documentation (as needed)
  • [ ] Updated migration guide (as needed)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge

@azeey azeey requested a review from chapulina as a code owner November 11, 2021 05:11
@azeey azeey self-assigned this Nov 11, 2021
@github-actions github-actions bot added the 🏰 citadel Ignition Citadel label Nov 11, 2021
@codecov
Copy link

codecov bot commented Nov 11, 2021

Codecov Report

Merging #1192 (ad5be5e) into ign-gazebo3 (9937209) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##           ign-gazebo3    #1192   +/-   ##
============================================
  Coverage        77.25%   77.25%           
============================================
  Files              227      227           
  Lines            13509    13509           
============================================
  Hits             10437    10437           
  Misses            3072     3072           
Impacted Files Coverage Δ
src/LevelManager.cc 86.36% <100.00%> (ø)
src/SimulationRunner.cc 94.49% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9937209...ad5be5e. Read the comment docs.

Copy link
Contributor

@chapulina chapulina left a comment

Choose a reason for hiding this comment

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

LGTM, I just have a question

src/SimulationRunner.cc Show resolved Hide resolved
@azeey azeey merged commit 6b22297 into gazebosim:ign-gazebo3 Nov 11, 2021
@azeey azeey deleted the sdf_find_element branch November 11, 2021 17:55
WilliamLewww pushed a commit to WilliamLewww/ign-gazebo that referenced this pull request Dec 7, 2021
…zebosim#1192)

Spurious <plugin> elements were created when saving worlds because sdf::Element::GetElement was used to check if a <plugin> child element exists. However this function always creates a new element if the element does not exist instead of returning a nullptr. The solution is to use sdf::Element::FindElement instead.

Signed-off-by: Addisu Z. Taddese <[email protected]>
Signed-off-by: William Lew <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏰 citadel Ignition Citadel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants