diff --git a/mailnews/imap/src/nsImapOfflineSync.cpp b/mailnews/imap/src/nsImapOfflineSync.cpp index 62ad5db1ce5..d3a1ff3670d 100644 --- a/mailnews/imap/src/nsImapOfflineSync.cpp +++ b/mailnews/imap/src/nsImapOfflineSync.cpp @@ -173,15 +173,16 @@ nsresult nsImapOfflineSync::AdvanceToNextFolder() void nsImapOfflineSync::AdvanceToFirstIMAPFolder() { + nsresult rv; m_currentServer = nsnull; - nsresult rv = AdvanceToNextFolder(); nsCOMPtr imapFolder; do { + rv = AdvanceToNextFolder(); if (m_currentFolder) imapFolder = do_QueryInterface(m_currentFolder); } - while (m_currentFolder && !imapFolder); + while (NS_SUCCEEDED(rv) && m_currentFolder && !imapFolder); } void nsImapOfflineSync::ProcessFlagOperation(nsIMsgOfflineImapOperation *currentOp)