File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed
examples/cpp/discovery_server Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -366,16 +366,24 @@ class CLIParser
366
366
// PubSub options
367
367
else if (arg == " -t" || arg == " --topic" )
368
368
{
369
- if (config.entity == CLIParser::EntityKind::CLIENT_PUBLISHER ||
370
- config.entity == CLIParser::EntityKind::CLIENT_SUBSCRIBER)
369
+ if (++i < argc)
371
370
{
372
- config.pub_config .topic_name = argv[i];
373
- config.sub_config .topic_name = argv[i];
371
+ if (config.entity == CLIParser::EntityKind::CLIENT_PUBLISHER ||
372
+ config.entity == CLIParser::EntityKind::CLIENT_SUBSCRIBER)
373
+ {
374
+ config.pub_config .topic_name = argv[i];
375
+ config.sub_config .topic_name = argv[i];
376
+ }
377
+ else
378
+ {
379
+ EPROSIMA_LOG_ERROR (CLI_PARSER,
380
+ " wrong or missing entity for --topic argument: only available for publisher and subscriber" );
381
+ print_help (EXIT_FAILURE);
382
+ }
374
383
}
375
384
else
376
385
{
377
- EPROSIMA_LOG_ERROR (CLI_PARSER,
378
- " wrong or missing entity for --topic argument: only available for publisher and subscriber" );
386
+ EPROSIMA_LOG_ERROR (CLI_PARSER, " missing argument for " + arg);
379
387
print_help (EXIT_FAILURE);
380
388
}
381
389
}
You can’t perform that action at this time.
0 commit comments