fix crash in ExpungeByIndex, a=standard8, bug 664790
authorDavid Bienvenu <bienvenu@nventure.com>
Tue, 09 Aug 2011 11:38:04 -0700
changeset 8333 52f5f813485abd4e641b035b69e2bc9b88c5798f
parent 8332 f323eeb4e6bce36594b784438006a2aa99c52e25
child 8334 c9f70dd77f6576eef38b4959834d230b7ba12683
push idunknown
push userunknown
push dateunknown
reviewersstandard8, bug
bugs664790
fix crash in ExpungeByIndex, a=standard8, bug 664790
mailnews/imap/src/nsImapFlagAndUidState.cpp
--- a/mailnews/imap/src/nsImapFlagAndUidState.cpp
+++ b/mailnews/imap/src/nsImapFlagAndUidState.cpp
@@ -165,18 +165,18 @@ NS_IMETHODIMP nsImapFlagAndUidState::Res
   return NS_OK;
 }
 
 
 // Remove (expunge) a message from our array, since now it is gone for good
 
 NS_IMETHODIMP nsImapFlagAndUidState::ExpungeByIndex(PRUint32 msgIndex)
 {
-  // protect ourselves in case the server gave us an index key of -1.....
-  if ((PRInt32) msgIndex < 0)
+  // protect ourselves in case the server gave us an index key of -1 or 0
+  if ((PRInt32) msgIndex <= 0)
     return NS_ERROR_INVALID_ARG;
 
   if ((PRUint32) fUids.Length() < msgIndex)
     return NS_ERROR_INVALID_ARG;
 
   PR_CEnterMonitor(this);
   msgIndex--;  // msgIndex is 1-relative
   if (fFlags[msgIndex] & kImapMsgDeletedFlag) // see if we already had counted this one as deleted