From ae5e2fe5e5c472a54fe3a1526a7ae443ec18d035 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Thu, 31 Dec 2020 17:50:40 +0100 Subject: [PATCH] properly ignore empty lines and comments in servers and channels config fixes #1242 --- src/core/channels-setup.c | 4 ++++ src/core/servers-setup.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/core/channels-setup.c b/src/core/channels-setup.c index 55b4533e..cd323a84 100644 --- a/src/core/channels-setup.c +++ b/src/core/channels-setup.c @@ -34,6 +34,10 @@ static int compare_channel_setup (CONFIG_NODE *node, CHANNEL_SETUP_REC *channel) { char *name, *chatnet; + /* skip comment nodes */ + if (node->type == NODE_TYPE_COMMENT) + return -1; + name = config_node_get_str(node, "name", NULL); chatnet = config_node_get_str(node, "chatnet", NULL); diff --git a/src/core/servers-setup.c b/src/core/servers-setup.c index 8662b30c..6e4e238a 100644 --- a/src/core/servers-setup.c +++ b/src/core/servers-setup.c @@ -472,6 +472,10 @@ static int compare_server_setup (CONFIG_NODE *node, SERVER_SETUP_REC *server) char *address, *chatnet; int port; + /* skip comment nodes */ + if (node->type == NODE_TYPE_COMMENT) + return -1; + address = config_node_get_str(node, "address", NULL); chatnet = config_node_get_str(node, "chatnet", NULL); port = config_node_get_int(node, "port", 0);