From 806bb9f1afcfcb2fe4f40b62548d83b141787a44 Mon Sep 17 00:00:00 2001 From: PolynomialDivision Date: Sun, 11 Jun 2017 19:32:38 +0200 Subject: [PATCH] Fix remove function --- src/datastorage.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/datastorage.c b/src/datastorage.c index efa5df9..a7cc2fe 100644 --- a/src/datastorage.c +++ b/src/datastorage.c @@ -182,9 +182,18 @@ node* remove_old_entries(node* head, time_t current_time, long long int threshol if(next->data.time < current_time - threshold) { head = remove_node(head, next, prev); - //print_list_with_head(head); - next = prev->ptr; - } else { + //print_list_with_head(head); + if(prev == NULL) // removed head + { + next = head; + } + else + { + next = prev->ptr; + } + } + else + { prev = next; next = next->ptr; }