From b6db87230398df46243c4fa39345a0f78cc7f694 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Wed, 25 Sep 2019 04:46:13 -0400 Subject: [PATCH] listener fix incorrect "never published" cases (#13006) - fixes #12955 --- src/systemcmds/topic_listener/listener_main.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/systemcmds/topic_listener/listener_main.cpp b/src/systemcmds/topic_listener/listener_main.cpp index 5236a5715cd1..1c8e9d5591ad 100644 --- a/src/systemcmds/topic_listener/listener_main.cpp +++ b/src/systemcmds/topic_listener/listener_main.cpp @@ -82,7 +82,16 @@ void listener(listener_print_topic_cb cb, const orb_id_t &id, unsigned num_msgs, } } + if (instances == 0) { + PX4_INFO_RAW("never published\n"); + } + } else { + // default to the first instance if not specified + if (topic_instance == -1) { + topic_instance = 0; + } + if (orb_exists(id, topic_instance) != 0) { PX4_INFO_RAW("never published\n"); return;