From 2af39974562619094441e0485b7ec7025d9dd717 Mon Sep 17 00:00:00 2001 From: apio Date: Mon, 26 Dec 2022 15:54:29 +0100 Subject: [PATCH] LinkedList: Fixed some boogs, LinkedList is now boog-free :) --- luna/include/luna/LinkedList.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/luna/include/luna/LinkedList.h b/luna/include/luna/LinkedList.h index bfb1f2de..cb2e6c66 100644 --- a/luna/include/luna/LinkedList.h +++ b/luna/include/luna/LinkedList.h @@ -49,12 +49,14 @@ template class LinkedListNode { end_node->m_next_node = this; this->m_last_node = end_node; + this->m_next_node = nullptr; } void prepend_to_list(SelfType* start_node) { start_node->m_last_node = this; this->m_next_node = start_node; + this->m_last_node = nullptr; } friend class LinkedList; @@ -104,6 +106,8 @@ template class LinkedList if (m_end_node == base_node) m_end_node = new_node; + if (base_node->get_next()) base_node->get_next()->set_last(new_node); + new_node->set_next(base_node->get_next()); base_node->set_next(new_node); new_node->set_last(base_node);