From: Mark Stapp Date: Tue, 5 Jul 2022 20:31:41 +0000 (-0400) Subject: lib: fix SA warning in typesafe code X-Git-Tag: base_8.4~271^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F11534%2Fhead;p=mirror%2Ffrr.git lib: fix SA warning in typesafe code There's a nagging SA warning, at least with the scan-build version we use in the FRR CI. Signed-off-by: Mark Stapp --- diff --git a/lib/typesafe.h b/lib/typesafe.h index 06fdc52e78..df963f530d 100644 --- a/lib/typesafe.h +++ b/lib/typesafe.h @@ -309,7 +309,8 @@ static inline void typesafe_dlist_add(struct dlist_head *head, struct dlist_item *prev, struct dlist_item *item) { item->next = prev->next; - item->next->prev = item; + if (item->next) + item->next->prev = item; item->prev = prev; prev->next = item; head->count++;