diff --git a/mailnews/base/src/nsMsgDBView.cpp b/mailnews/base/src/nsMsgDBView.cpp index 41bc20cf9d1a..4943af36d93f 100644 --- a/mailnews/base/src/nsMsgDBView.cpp +++ b/mailnews/base/src/nsMsgDBView.cpp @@ -3154,13 +3154,13 @@ PRInt32 nsMsgDBView::FindLevelInThread(nsIMsgDBHdr *msgHdr, nsMsgViewIndex start } nsresult nsMsgDBView::ListIdsInThreadOrder(nsIMsgThread *threadHdr, nsMsgKey parentKey, PRInt32 level, nsMsgViewIndex *viewIndex, PRUint32 *pNumListed) -{ +{ nsresult rv = NS_OK; nsCOMPtr msgEnumerator; threadHdr->EnumerateMessages(parentKey, getter_AddRefs(msgEnumerator)); - PRUint32 numChildren; - (void) threadHdr->GetNumChildren(&numChildren); - + PRUint32 numChildren; + (void) threadHdr->GetNumChildren(&numChildren); + // skip the first one. PRBool hasMore; nsCOMPtr supports; @@ -3187,17 +3187,17 @@ nsresult nsMsgDBView::ListIdsInThreadOrder(nsIMsgThread *threadHdr, nsMsgKey par // turn off thread or elided bit if they got turned on (maybe from new only view?) msgHdr->AndFlags(~(MSG_VIEW_FLAG_ISTHREAD | MSG_FLAG_ELIDED), &newFlags); (*pNumListed)++; - (*viewIndex)++; - if (*pNumListed > numChildren) - { - NS_ASSERTION(PR_FALSE, "thread corrupt in db"); - // if we've listed more messages than are in the thread, then the db - // is corrupt, and we should invalidate it. - // we'll use this rv to indicate there's something wrong with the db - // though for now it probably won't get paid attention to. - m_db->SetSummaryValid(PR_FALSE); - rv = NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE; - break; + (*viewIndex)++; + if (*pNumListed > numChildren) + { + NS_ASSERTION(PR_FALSE, "thread corrupt in db"); + // if we've listed more messages than are in the thread, then the db + // is corrupt, and we should invalidate it. + // we'll use this rv to indicate there's something wrong with the db + // though for now it probably won't get paid attention to. + m_db->SetSummaryValid(PR_FALSE); + rv = NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE; + break; } rv = ListIdsInThreadOrder(threadHdr, msgKey, level + 1, viewIndex, pNumListed); }