fixes bug 324981 "nsTArray crash in RemoveElement" r=bsmedberg

git-svn-id: svn://10.0.0.236/trunk@188465 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
darin%meer.net
2006-01-30 17:16:50 +00:00
parent 5682413028
commit fff2cf22d2
2 changed files with 5 additions and 1 deletions

View File

@@ -473,7 +473,7 @@ class nsTArray : public nsTArray_base {
template<class Item, class Comparator>
void RemoveElement(const Item& item, const Comparator& comp) {
index_type i = IndexOf(item, 0, comp);
if (i >= 0)
if (i != NoIndex)
RemoveElementAt(i);
}

View File

@@ -121,6 +121,10 @@ static PRBool test_basic_array(ElementType *data,
ary.AppendElements(nsnull, 0);
ary.AppendElements(empty);
// See bug 324981
ary.RemoveElement(extra);
ary.RemoveElement(extra);
return PR_TRUE;
}