From 2f222d6cbf0b0d3b18e645e3e683920243655d36 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Thu, 8 Aug 2019 12:19:32 -0400 Subject: [PATCH] containers/List add nullptr check --- src/include/containers/List.hpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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;