Fix crash in XUL sort service -- unsigned ints are never less than 0... Bug

220516, r+sr=dbaron


git-svn-id: svn://10.0.0.236/trunk@147390 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bzbarsky%mit.edu
2003-09-28 06:05:08 +00:00
parent 426a584ee4
commit d3f59fd91c

View File

@@ -1103,7 +1103,9 @@ XULSortServiceImpl::SortContainer(nsIContent *container, sortPtr sortInfo,
nsCOMPtr<nsIAtom> tag;
currentElement = numChildren;
PRUint32 childIndex;
for (childIndex = numChildren - 1; childIndex >= 0; --childIndex) {
// childIndex is unsigned, so childIndex >= 0 would always test true
for (childIndex = numChildren; childIndex > 0; ) {
--childIndex;
nsIContent *child = container->GetChildAt(childIndex);
if (child->IsContentOfType(nsIContent::eXUL)) {
@@ -1162,8 +1164,10 @@ XULSortServiceImpl::SortContainer(nsIContent *container, sortPtr sortInfo,
sizeof(contentSortInfo*), testSortCallback, (void*)sortInfo);
}
for (childIndex = numChildren - 1; childIndex >= 0; childIndex--)
// childIndex is unsigned, so childIndex >= 0 would always test true
for (childIndex = numChildren; childIndex > 0; )
{
--childIndex;
nsIContent *child = container->GetChildAt(childIndex);
if (child->IsContentOfType(nsIContent::eXUL)) {