Backout Bug 632835 in order to fix Bug 632835, a=backout

This commit is contained in:
Olli Pettay 2011-02-26 18:30:57 +02:00
parent 278fb10107
commit 5170d49ed9

View File

@ -645,7 +645,13 @@ nsSHEntry::AddChild(nsISHEntry * aChild, PRInt32 aOffset)
}
#endif
if (!mChildren.ReplaceObjectAt(aChild, aOffset)) {
// InsertObjectAt allows only appending one object.
// If aOffset is larger than Count(), we must first manually
// set the capacity.
if (aOffset > mChildren.Count()) {
mChildren.SetCount(aOffset);
}
if (!mChildren.InsertObjectAt(aChild, aOffset)) {
NS_WARNING("Adding a child failed!");
aChild->SetParent(nsnull);
return NS_ERROR_FAILURE;