From: Jérôme Benoit Date: Tue, 7 Mar 2017 14:29:45 +0000 (+0100) Subject: TP5: Properly guard against NULL testing an element in the searching X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=cdc1c7e22e77a2e59ba618de65eecb8fb3178eab;p=Algorithmic_C.git TP5: Properly guard against NULL testing an element in the searching function. Signed-off-by: Jérôme Benoit --- diff --git a/TP5/exo4/liste_chainee.c b/TP5/exo4/liste_chainee.c index b21ad04..96baad7 100644 --- a/TP5/exo4/liste_chainee.c +++ b/TP5/exo4/liste_chainee.c @@ -99,9 +99,9 @@ bool rechercher_iter(element e, Liste L) while (L != NULL && L->valeur != e) { L = L->suivant; + if (L->valeur == e) + rt_val = true; } - if (L->valeur == e) - rt_val = true; return rt_val; }