diff --git a/ll.h b/ll.h index 90c2e95..ae6427c 100644 --- a/ll.h +++ b/ll.h @@ -118,9 +118,8 @@ llList * _llInsert(llList * list, size_t id, void * value) { if (node->next == NULL && id > 1) { - fprintf(stderr, "RUNTIME ERROR: Index out of bounds\n"); - llFree(list); - exit(1); + fprintf(stderr, "ERROR: Index out of bounds\n"); + return list; } prev = node; @@ -154,8 +153,7 @@ llList * _llDelete(llList * list, size_t id) if (node->next == NULL) { fprintf(stderr, "RUNTIME ERROR: Index out of bounds\n"); - llFree(list); - exit(1); + return list; } prev = node; @@ -199,8 +197,7 @@ void * _llGetRef(llList * list, size_t id) if (node->next == NULL) { fprintf(stderr, "RUNTIME ERROR: Index out of bounds\n"); - llFree(list); - exit(1); + return NULL; } node = node->next;