diff --git a/mailnews/db/msgdb/src/nsMsgThread.cpp b/mailnews/db/msgdb/src/nsMsgThread.cpp index 3f992db911a..ab32fe6b81b 100644 --- a/mailnews/db/msgdb/src/nsMsgThread.cpp +++ b/mailnews/db/msgdb/src/nsMsgThread.cpp @@ -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);