mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 12:48:53 +08:00
containers/List add nullptr check
This commit is contained in:
@@ -68,13 +68,14 @@ public:
|
|||||||
|
|
||||||
bool remove(T removeNode)
|
bool remove(T removeNode)
|
||||||
{
|
{
|
||||||
|
if (removeNode == nullptr) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// base case
|
// base case
|
||||||
if (removeNode == _head) {
|
if (removeNode == _head) {
|
||||||
if (_head->getSibling() != nullptr) {
|
if (_head != nullptr) {
|
||||||
_head = _head->getSibling();
|
_head = _head->getSibling();
|
||||||
|
|
||||||
} else {
|
|
||||||
_head = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user