gazebosim / gz-msgs

Messages for Gazebo robot simulation.
https://gazebosim.org
Apache License 2.0
24 stars 47 forks source link

Return nullptr when message fails to populate #384

Closed mjcarroll closed 1 year ago

mjcarroll commented 1 year ago

When creating a message with user-provided string data, in the event that the string data isn't well formed, we should be returning a nullptr rather than an empty message. This indicates to the caller that we failed to create the full message.

codecov[bot] commented 1 year ago

Codecov Report

Merging #384 (4bb4904) into gz-msgs10 (50ee1e4) will increase coverage by 0.00%. Report is 1 commits behind head on gz-msgs10. The diff coverage is 100.00%.

:exclamation: Current head 4bb4904 differs from pull request most recent head fae61ec. Consider uploading reports for the commit fae61ec to get more accurate results

@@            Coverage Diff             @@
##           gz-msgs10     #384   +/-   ##
==========================================
  Coverage      97.26%   97.26%           
==========================================
  Files             27       27           
  Lines           1169     1170    +1     
==========================================
+ Hits            1137     1138    +1     
  Misses            32       32           
Files Changed Coverage Δ
core/include/gz/msgs/PointCloudPackedUtils.hh 94.91% <ø> (ø)
core/src/MessageFactory.cc 97.91% <100.00%> (+0.04%) :arrow_up:
mjcarroll commented 1 year ago

Looks good to me!

I ended up also adding a test here to prevent regressions