Bug 1398543 - Add missing condition in DoublyLinkedList::ElementNotInList. r=froydnj

--HG--
extra : rebase_source : fa07b148bd0d7e7428e70fb8a05edb5792836135
This commit is contained in:
Mike Hommey 2017-09-10 08:49:56 +09:00
Родитель 507bd6716f
Коммит 18212266ea
1 изменённых файлов: 9 добавлений и 2 удалений

Просмотреть файл

@ -117,8 +117,15 @@ class DoublyLinkedList final
return (mHead != nullptr) == (mTail != nullptr);
}
static bool ElementNotInList(T* aElm) {
return !SiblingAccess::GetNext(aElm) && !SiblingAccess::GetPrev(aElm);
bool ElementNotInList(T* aElm) {
if (!SiblingAccess::GetNext(aElm) && !SiblingAccess::GetPrev(aElm)) {
// Both mNext and mPrev being NULL can mean two things:
// - the element is not in the list.
// - the element is the first and only element in the list.
// So check for the latter.
return mHead != aElm;
}
return false;
}
public: