mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-14 04:03:47 +00:00
Bug 1919031 - Also check for out of bounds before populating the cache. r=smaug
I guess since facebook does this it is probably worth it. Differential Revision: https://phabricator.services.mozilla.com/D224314
This commit is contained in:
parent
c28b75f295
commit
15378d9238
@ -433,8 +433,11 @@ nsIContent* nsParentNodeChildContentList::Item(uint32_t aIndex) {
|
||||
if (aIndex == 0) {
|
||||
return mNode->GetFirstChild();
|
||||
}
|
||||
// This is correct even if the addition overflows.
|
||||
if (aIndex + 1 == mNode->GetChildCount()) {
|
||||
uint32_t childCount = mNode->GetChildCount();
|
||||
if (aIndex >= childCount) {
|
||||
return nullptr;
|
||||
}
|
||||
if (aIndex + 1 == childCount) {
|
||||
return mNode->GetLastChild();
|
||||
}
|
||||
ValidateCache();
|
||||
|
Loading…
x
Reference in New Issue
Block a user