Bug 833399 - Fix crash in nsImapOfflineTxn::UndoTransaction - check number of actions to undo. r+a=Standard8
authoraceman <acelists@atlas.sk>
Wed, 27 Mar 2013 16:14:44 -0400
changeset 13672 39d8c27a94da8ebc82fd6069719749876cb15e58
parent 13671 db4c8f00540ab0ef4b097106717b7061d70fe64c
child 13673 9926a6beae3962bbbc668e4ebf97707220bd3a37
push id56
push userbugzilla@standard8.plus.com
push dateWed, 19 Jun 2013 09:43:24 +0000
bugs833399
Bug 833399 - Fix crash in nsImapOfflineTxn::UndoTransaction - check number of actions to undo. r+a=Standard8
mailnews/imap/src/nsImapUndoTxn.cpp
--- a/mailnews/imap/src/nsImapUndoTxn.cpp
+++ b/mailnews/imap/src/nsImapUndoTxn.cpp
@@ -543,16 +543,21 @@ NS_IMETHODIMP nsImapOfflineTxn::UndoTran
   switch (m_opType)
   {
     case nsIMsgOfflineImapOperation::kMsgMoved:
     case nsIMsgOfflineImapOperation::kMsgCopy:
     case nsIMsgOfflineImapOperation::kAddedHeader:
     case nsIMsgOfflineImapOperation::kFlagsChanged:
     case nsIMsgOfflineImapOperation::kDeletedMsg:
     {
+      if (m_srcHdrs.IsEmpty())
+      {
+        NS_ASSERTION(false, "No msg header to apply undo.");
+        break;
+      }
       nsCOMPtr<nsIMsgDBHdr> firstHdr = m_srcHdrs[0];
       nsMsgKey hdrKey;
       firstHdr->GetMessageKey(&hdrKey);
       rv = srcDB->GetOfflineOpForKey(hdrKey, false, getter_AddRefs(op));
       bool offlineOpPlayedBack = true;
       if (NS_SUCCEEDED(rv) && op)
       {
         op->GetPlayingBack(&offlineOpPlayedBack);