Bug 723888 - crash SyncRunnable5<nsIImapMailFolderSink, nsIImapProtocol* ... typically working with folder subscribe. r=irving, a=Standard8.
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Wed, 31 Oct 2012 17:05:29 +0900
changeset 13540 3cb3fc93b072bc4a9fe7fadcc99c746ccb940e7b
parent 13539 7dbb40e0446514292ffa7067785f4057397a4d10
child 13541 2658b6a23192c126aa1054cdb142931472c7a22c
push idunknown
push userunknown
push dateunknown
reviewersirving, Standard8
bugs723888
Bug 723888 - crash SyncRunnable5<nsIImapMailFolderSink, nsIImapProtocol* ... typically working with folder subscribe. r=irving, a=Standard8.
mailnews/imap/src/nsImapProtocol.cpp
mailnews/imap/src/nsSyncRunnableHelpers.h
--- a/mailnews/imap/src/nsImapProtocol.cpp
+++ b/mailnews/imap/src/nsImapProtocol.cpp
@@ -577,17 +577,20 @@ nsImapProtocol::SetupSinkProxy()
 {
   nsresult res;
   if (m_runningUrl)
   {
     if (!m_imapMailFolderSink)
     {
       nsCOMPtr<nsIImapMailFolderSink> aImapMailFolderSink;
       (void) m_runningUrl->GetImapMailFolderSink(getter_AddRefs(aImapMailFolderSink));
-      m_imapMailFolderSink = new ImapMailFolderSinkProxy(aImapMailFolderSink);
+      if (aImapMailFolderSink)
+      {
+        m_imapMailFolderSink = new ImapMailFolderSinkProxy(aImapMailFolderSink);
+      }
     }
 
     if (!m_imapMessageSink)
     {
       nsCOMPtr<nsIImapMessageSink> aImapMessageSink;
       (void) m_runningUrl->GetImapMessageSink(getter_AddRefs(aImapMessageSink));
       m_imapMessageSink = new ImapMessageSinkProxy(aImapMessageSink);
     }
--- a/mailnews/imap/src/nsSyncRunnableHelpers.h
+++ b/mailnews/imap/src/nsSyncRunnableHelpers.h
@@ -33,17 +33,19 @@ private:
   nsCOMPtr<nsIStreamListener> mReceiver;
 };
 
 class ImapMailFolderSinkProxy : public nsIImapMailFolderSink
 {
 public:
   ImapMailFolderSinkProxy(nsIImapMailFolderSink* receiver)
     : mReceiver(receiver)
-  { }
+  {
+    NS_ASSERTION(receiver, "Don't allow receiver is nullptr");
+  }
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIIMAPMAILFOLDERSINK
 
 private:
   nsCOMPtr<nsIImapMailFolderSink> mReceiver;
 };