Add a check for seemingly unreachable condition found by scan-build

The logic of finding the event that happend just before the created one
This commit is contained in:
Vftdan 2024-08-15 17:06:20 +02:00
parent 63dabd6fcd
commit f126a60412
1 changed files with 6 additions and 0 deletions

View File

@ -1,3 +1,5 @@
#include <stdio.h>
#include <stdlib.h>
#include "events.h" #include "events.h"
EventNode EventNode
@ -49,6 +51,10 @@ event_create(const EventData * content)
list_pos = &other->next->prev; list_pos = &other->next->prev;
} }
EventNode * prev = *list_pos; EventNode * prev = *list_pos;
if (!prev) {
fprintf(stderr, "*list_pos is NULL\n");
abort();
}
event->next = prev->next; event->next = prev->next;
event->prev = prev; event->prev = prev;
prev->next->prev = event; prev->next->prev = event;