fix potential nul pointer dereference

This commit is contained in:
Richard Frith-Macdonald 2021-01-14 09:29:42 +00:00
parent 6eb08935ea
commit 2a1ec7970c

View file

@ -372,7 +372,7 @@ GSLinkedListInsertAfter(GSListLink *link, GSLinkedList *list, GSListLink *at)
{
at = list->tail;
}
link->next = at->next;
link->next = at ? at->next : nil;
if (nil == link->next)
{
list->tail = link;
@ -381,7 +381,10 @@ GSLinkedListInsertAfter(GSListLink *link, GSLinkedList *list, GSListLink *at)
{
link->next->previous = link;
}
at->next = link;
if (at)
{
at->next = link;
}
link->previous = at;
}
link->owner = list;