Преглед изворни кода

faux.list: Fix adding to list tail

Serj Kalichev пре 4 година
родитељ
комит
3c21bd37d6
1 измењених фајлова са 2 додато и 1 уклоњено
  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;