From 146da13e432e35a29f42f60f781fd5c5b0284c3a Mon Sep 17 00:00:00 2001 From: apio Date: Tue, 6 Dec 2022 18:23:19 +0100 Subject: [PATCH] LinkedList: Make sure to explicitly mark the first node's next and last nodes as nullptr --- luna/include/luna/LinkedList.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/luna/include/luna/LinkedList.h b/luna/include/luna/LinkedList.h index 081dec8e..e6056a19 100644 --- a/luna/include/luna/LinkedList.h +++ b/luna/include/luna/LinkedList.h @@ -40,6 +40,8 @@ template class DoublyLinkedList DoublyLinkedListNode* node = (DoublyLinkedListNode*)ptr; if (!m_start_node) m_start_node = node; if (m_end_node) node->add_to_list(m_end_node); + else + node->m_next_node = node->m_last_node = nullptr; m_end_node = node; m_count++;