Added nullptr check in remove_node_after

This commit is contained in:
John Wellbelove 2015-10-08 11:06:12 +01:00
parent 1ba191fa51
commit 02211e969c

View File

@ -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<Data_Node&>(*p_node));
// Destroy the pool object.
destroy_data_node(static_cast<Data_Node&>(*p_node));
// One less.
--current_size;
// One less.
--current_size;
}
}
//*************************************************************************