diff --git a/iforward_list.h b/iforward_list.h index 0709ab99..136f701d 100644 --- a/iforward_list.h +++ b/iforward_list.h @@ -1025,14 +1025,17 @@ namespace etl // The node to erase. Node* p_node = node.next; - // Disconnect the node from the forward_list. - join(node, *p_node->next); + if (p_node != nullptr) + { + // Disconnect the node from the forward_list. + join(node, *p_node->next); - // Destroy the pool object. - destroy_data_node(static_cast(*p_node)); + // Destroy the pool object. + destroy_data_node(static_cast(*p_node)); - // One less. - --current_size; + // One less. + --current_size; + } } //*************************************************************************