Skip to content

Commit

Permalink
fix bug #924 (messages with no fields)
Browse files Browse the repository at this point in the history
  • Loading branch information
facontidavide committed Jan 24, 2024
1 parent 2ef9b91 commit e89c463
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion plotjuggler_plugins/ParserROS/ros_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ ParserROS::ParserROS(const std::string& topic_name, const std::string& type_name
clampLargeArray() ? Parser::KEEP_LARGE_ARRAYS : Parser::DISCARD_LARGE_ARRAYS;

_parser.setMaxArrayPolicy(policy, maxArraySize());
_has_header = _parser.getSchema()->root_msg->field(0).type().baseName() == "std_msgs/Header";

const auto& root_fields = _parser.getSchema()->root_msg->fields();
_has_header = !root_fields.empty() && root_fields.front().type().baseName() == "std_msgs/Header";

using std::placeholders::_1;
using std::placeholders::_2;
Expand Down
2 changes: 1 addition & 1 deletion plotjuggler_plugins/ParserROS/ros_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ParserROS : public PJ::MessageParser

protected:
RosMsgParser::Parser _parser;
std::shared_ptr<RosMsgParser::Deserializer> _deserializer;
std::unique_ptr<RosMsgParser::Deserializer> _deserializer;
RosMsgParser::FlatMessage _flat_msg;
std::string _topic;

Expand Down

0 comments on commit e89c463

Please sign in to comment.