fix crash in AddNewNamespace. We were iterating through a list of name spaces backwards incorrectly. We were starting with one past the last element in the array and then attempting to dereference it....

This commit is contained in:
mscott%netscape.com 1999-04-15 01:22:07 +00:00
parent 485ceb9e8c
commit eb551ad681

View File

@ -104,13 +104,13 @@ int nsIMAPNamespaceList::AddNewNamespace(nsIMAPNamespace *ns)
if (!ns->GetIsNamespaceFromPrefs())
{
int nodeIndex = 0;
for (nodeIndex=m_NamespaceList.Count(); nodeIndex > 0; nodeIndex--)
for (nodeIndex=m_NamespaceList.Count()-1; nodeIndex >= 0; nodeIndex--)
{
nsIMAPNamespace *nspace = (nsIMAPNamespace *) m_NamespaceList.ElementAt(nodeIndex);
if (nspace->GetIsNamespaceFromPrefs())
if (nspace && nspace->GetIsNamespaceFromPrefs())
{
m_NamespaceList.RemoveElement(nspace);
delete nspace;
delete nspace;
}
}
}