From d59c50ef0d19645b9a5c9145d0c91e011d461ec9 Mon Sep 17 00:00:00 2001
From: Kubat <mael.martin31@gmail.com>
Date: Wed, 12 Jan 2022 19:10:29 +0100
Subject: [PATCH] MISC: Fix the trie print function

---
 src/net/listen.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/net/listen.c b/src/net/listen.c
index f3300ab6..700f73fb 100644
--- a/src/net/listen.c
+++ b/src/net/listen.c
@@ -126,7 +126,12 @@ ___cmd_trie_print(struct cmd_trie_node *root, char *old_prefix, const size_t len
     memcpy(prefix, old_prefix, sizeof(char) * length);
     prefix[length + 1] = '\0';
     prefix[length]     = '\0';
-    LKT_OUTPUT("CMD_TRIE", "Got function in trie '%s'", prefix);
+
+    /* Found a command? */
+    if (root->cmd_ptr != NULL) {
+        LKT_OUTPUT("CMD_TRIE", "Got function in trie '%s'", prefix);
+    }
+
     for (size_t i = 0; i < CHARS_MAX; ++i) {
         /* Rec-call with new children */
         if (root->children[i] != NULL) {
-- 
GitLab