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:
parent
63dabd6fcd
commit
f126a60412
6
events.c
6
events.c
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue