Browse Source

faux.list: Fix adding to list tail

Serj Kalichev 4 years ago
parent
commit
3c21bd37d6
1 changed files with 2 additions and 1 deletions
  1. 2 1
      faux/list/list.c

+ 2 - 1
faux/list/list.c

@@ -347,7 +347,8 @@ static faux_list_node_t *faux_list_add_generic(
 		// Add entry to the tail
 		node->prev = list->tail;
 		node->next = NULL;
-		list->tail->next = node;
+		if (list->tail)
+			list->tail->next = node;
 		list->tail = node;
 		list->len++;
 		return node;