diff --git a/include/utils/hdf_dlist.h b/include/utils/hdf_dlist.h index 196a4d2c847dcf00456f1d16cf3ec949d9d2e2fd..4d4ad67c32459c36f1bb0c41b45e79480a7361a2 100644 --- a/include/utils/hdf_dlist.h +++ b/include/utils/hdf_dlist.h @@ -80,8 +80,13 @@ static inline bool DListIsEmpty(const struct DListHead *head) */ static inline void DListRemove(struct DListHead *entry) { - entry->prev->next = entry->next; - entry->next->prev = entry->prev; + if (entry->prev != NULL) { + entry->prev->next = entry->next; + } + + if (entry->next != NULL) { + entry->next->prev = entry->prev; + } entry->prev = NULL; entry->next = NULL;