diff --git a/src/include/containers/List.hpp b/src/include/containers/List.hpp index 5cf7447beb3b..119efa207150 100644 --- a/src/include/containers/List.hpp +++ b/src/include/containers/List.hpp @@ -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;