Skip to content

Commit

Permalink
Fix unused-result warning (#408)
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters committed Jun 15, 2023
1 parent 95d8599 commit 19263e4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/cmd/gz.cc
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,16 @@ extern "C" void cmdTopicEcho(const char *_topic,
case MsgOutputFormat::kJSON:
{
std::string jsonStr;
google::protobuf::util::MessageToJsonString(_msg, &jsonStr);
std::cout << jsonStr << std::endl;
auto status =
google::protobuf::util::MessageToJsonString(_msg, &jsonStr);
if (status.ok())
{
std::cout << jsonStr << std::endl;
}
else
{
std::cerr << status;
}
}
break;
default:
Expand Down

0 comments on commit 19263e4

Please sign in to comment.