From f126a60412e8732e0426c23588e5184837803a99 Mon Sep 17 00:00:00 2001 From: Vftdan Date: Thu, 15 Aug 2024 17:06:20 +0200 Subject: [PATCH] Add a check for seemingly unreachable condition found by scan-build The logic of finding the event that happend just before the created one --- events.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/events.c b/events.c index 81fe063..e2a0ca4 100644 --- a/events.c +++ b/events.c @@ -1,3 +1,5 @@ +#include +#include #include "events.h" EventNode @@ -49,6 +51,10 @@ event_create(const EventData * content) list_pos = &other->next->prev; } EventNode * prev = *list_pos; + if (!prev) { + fprintf(stderr, "*list_pos is NULL\n"); + abort(); + } event->next = prev->next; event->prev = prev; prev->next->prev = event;