bulletproof against num thread children getting to 0 r=jefft

This commit is contained in:
bienvenu%netscape.com 2000-01-24 15:51:47 +00:00
Родитель 65b695518b
Коммит 62562d8fcd
1 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -830,6 +830,8 @@ nsresult nsMsgThread::ChangeChildCount(PRInt32 delta)
childCount += delta;
NS_ASSERTION((PRInt32) childCount >= 0, "child count gone to 0 or below");
if ((PRInt32) childCount <= 0) // force child count to > 0
childCount = 1;
ret = m_mdbDB->UInt32ToRowCellColumn(m_metaRow, m_mdbDB->m_threadChildrenColumnToken, childCount);
m_numChildren = childCount;
@ -867,6 +869,9 @@ nsresult nsMsgThread::GetChildHdrForKey(nsMsgKey desiredKey, nsIMsgDBHdr **resul
GetNumChildren(&numChildren);
if ((PRInt32) numChildren < 0)
numChildren = 0;
for (childIndex = 0; childIndex < numChildren; childIndex++)
{
rv = GetChildHdrAt(childIndex, result);