[CHANGE] added checks in 'delete_node' function.

This commit is contained in:
max 2024-10-28 19:47:07 +01:00
parent c3a2f00edc
commit 9c8cdcd94d

View File

@ -41,8 +41,10 @@ void delete_node(list_node* node)
{ {
if (node == NULL) if (node == NULL)
return; return;
node->previous->next = node->next; if (node->previous != NULL)
node->next->previous = node->previous; node->previous->next = node->next;
if (node->next != NULL)
node->next->previous = node->previous;
free(node); free(node);
} }