aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/helper/command.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/helper/command.c b/src/helper/command.c
index 869eff55..ec66c2d2 100644
--- a/src/helper/command.c
+++ b/src/helper/command.c
@@ -1119,7 +1119,7 @@ int help_add_command(struct command_context *cmd_ctx, struct command *parent,
.name = cmd_name,
.mode = COMMAND_ANY,
.help = help_text,
- .usage = usage,
+ .usage = usage ? : "",
};
nc = register_command(cmd_ctx, parent, &cr);
if (NULL == nc) {
@@ -1144,8 +1144,9 @@ int help_add_command(struct command_context *cmd_ctx, struct command *parent,
if (usage) {
bool replaced = false;
if (nc->usage) {
+ if (*nc->usage)
+ replaced = true;
free(nc->usage);
- replaced = true;
}
nc->usage = strdup(usage);
if (replaced)