Return undefined error if fetching element of list that is NULL

This commit is contained in:
Alex D. 2021-08-14 11:58:05 +00:00
parent b0fe2f65f2
commit ef4fce4cb9
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
2 changed files with 9 additions and 1 deletions

View File

@ -1,3 +1,3 @@
VERSION = 1.1.1
VERSION = 1.2.0
PREFIX = /usr/local
CC = clang

View File

@ -167,6 +167,10 @@ corelibs_llist_get_next(const llist_t* e, llist_t** save)
goto ret;
}
if (e->next == NULL) {
err = CORELIBS_LLIST_ERR_UNDEF;
goto ret;
}
*save = e->next;
ret:
return err;
@ -182,6 +186,10 @@ corelibs_llist_get_prev(const llist_t* e, llist_t** save)
goto ret;
}
if (e->prev == NULL) {
err = CORELIBS_LLIST_ERR_UNDEF;
goto ret;
}
*save = e->prev;
ret:
return err;