From 9c8cdcd94d6f27b1aa195777bf77527cb897b4ea Mon Sep 17 00:00:00 2001 From: max Date: Mon, 28 Oct 2024 19:47:07 +0100 Subject: [PATCH] [CHANGE] added checks in 'delete_node' function. --- src/net/collections/list.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/net/collections/list.c b/src/net/collections/list.c index 2e5eb61..e7c93e7 100644 --- a/src/net/collections/list.c +++ b/src/net/collections/list.c @@ -41,8 +41,10 @@ void delete_node(list_node* node) { if (node == NULL) return; - node->previous->next = node->next; - node->next->previous = node->previous; + if (node->previous != NULL) + node->previous->next = node->next; + if (node->next != NULL) + node->next->previous = node->previous; free(node); }