Skip to content

Commit

Permalink
containers/List add nullptr check
Browse files Browse the repository at this point in the history
  • Loading branch information
dagar authored and bkueng committed Aug 9, 2019
1 parent 9481b3b commit 2f222d6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/include/containers/List.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,14 @@ class List

bool remove(T removeNode)
{
if (removeNode == nullptr) {
return false;
}

// base case
if (removeNode == _head) {
if (_head->getSibling() != nullptr) {
if (_head != nullptr) {
_head = _head->getSibling();

} else {
_head = nullptr;
}

return true;
Expand Down

0 comments on commit 2f222d6

Please sign in to comment.