mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 18:08:58 +00:00
Bug 588643 - Crash in [@ nsDocShell::SetHistoryEntry ], r=bent/neil, a=blocking
This commit is contained in:
parent
726a81b08d
commit
a9d5a636f3
@ -642,7 +642,17 @@ nsSHEntry::AddChild(nsISHEntry * aChild, PRInt32 aOffset)
|
||||
}
|
||||
#endif
|
||||
|
||||
mChildren.InsertObjectAt(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;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user