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

This commit is contained in:
darin%meer.net 2006-01-30 17:16:50 +00:00
parent 45f4011af8
commit c7c435dffa
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;
}