X-Git-Url: https://git.piment-noir.org/?p=TD_C.git;a=blobdiff_plain;f=TP_9%2Fexo2%2Fclist.c;h=9ebb34817e5982fa3b3131e388d01b320f6a3a70;hp=edc296473e54c3910d0d4ea5fe3c3058aaf2913a;hb=abe54438847c1a491145a7719e43d19950732569;hpb=1d97ec3c592317db3549070d2e01c28d444f8b45 diff --git a/TP_9/exo2/clist.c b/TP_9/exo2/clist.c index edc2964..9ebb348 100644 --- a/TP_9/exo2/clist.c +++ b/TP_9/exo2/clist.c @@ -57,7 +57,9 @@ link_t* list_delete(link_t* head, unsigned index) { link_t* head_next = NULL; link_t* head_ret = NULL; - if (index == 0) { + if (head == NULL) { + return NULL; + } else if (index == 0) { head_next = head->next; free(head); head = head_next;