From 2b3f43d47a7766b4ad56c3384d58bd16527a178d Mon Sep 17 00:00:00 2001 From: Laurence de Bruxelles Date: Tue, 24 Apr 2018 15:15:18 +0100 Subject: [PATCH] topic_tools: Check that output topic is valid in demux. Fixes #1366 (#1367) --- tools/topic_tools/src/demux.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/topic_tools/src/demux.cpp b/tools/topic_tools/src/demux.cpp index 8d414d4cad..6511c25a65 100644 --- a/tools/topic_tools/src/demux.cpp +++ b/tools/topic_tools/src/demux.cpp @@ -152,6 +152,9 @@ void in_cb(const boost::shared_ptr& msg) ros::Duration(0.5).sleep(); } + // check that we have a valid topic + if (!g_selected->pub) return; + // finally: send out the message over the active publisher g_selected->pub->publish(msg); ROS_DEBUG("... and sent it out again!"); @@ -307,4 +310,3 @@ int main(int argc, char **argv) g_pubs.clear(); return 0; } -