diff --git a/luna/include/luna/LinkedList.h b/luna/include/luna/LinkedList.h index 3c6bcb44..6a899ea1 100644 --- a/luna/include/luna/LinkedList.h +++ b/luna/include/luna/LinkedList.h @@ -2,7 +2,7 @@ #include #include -template inline Option nonnull_or_error(T* ptr) +template inline Option nonnull_or_empty_option(T* ptr) { if (ptr == nullptr) return {}; else @@ -131,7 +131,7 @@ template class LinkedList Option first() { - return nonnull_or_error((T*)m_start_node); + return nonnull_or_empty_option((T*)m_start_node); } T* expect_first() @@ -142,7 +142,7 @@ template class LinkedList Option last() { - return nonnull_or_error((T*)m_end_node); + return nonnull_or_empty_option((T*)m_end_node); } T* expect_last() @@ -153,12 +153,12 @@ template class LinkedList Option next(T* item) { - return nonnull_or_error((T*)extract_node(item)->get_next()); + return nonnull_or_empty_option((T*)extract_node(item)->get_next()); } Option previous(T* item) { - return nonnull_or_error((T*)extract_node(item)->get_last()); + return nonnull_or_empty_option((T*)extract_node(item)->get_last()); } // Iterates over the elements of the LinkedList from start to end, calling callback for every element.