diff --git a/src/modules/zenoh/zenoh_config.cpp b/src/modules/zenoh/zenoh_config.cpp index be4886eae4..840770de93 100644 --- a/src/modules/zenoh/zenoh_config.cpp +++ b/src/modules/zenoh/zenoh_config.cpp @@ -276,9 +276,14 @@ int Zenoh_Config::getPubSubMapping(char *topic, char *type, const char *filename const char *config_type = get_csv_field(buffer, 2); const char *config_topic = get_csv_field(buffer, 1); - strncpy(type, config_type, TOPIC_INFO_SIZE); - strncpy(topic, config_topic, TOPIC_INFO_SIZE); - return 1; + if (config_topic && config_type) { + strncpy(type, config_type, TOPIC_INFO_SIZE); + strncpy(topic, config_topic, TOPIC_INFO_SIZE); + return 1; + + } else { + return -1; + } } }