Bug 919247 - crash in nsMsgDBView::SetThreadIgnored(nsIMsgThread*, unsigned int, bool). r+a=standard8
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Tue, 17 Dec 2013 21:37:37 +0200
changeset 16084 398539608a8b04ad8efa6dbae0dda392302d84a5
parent 16083 f98c23e31b024dc14ee3c2d5d813e2c8302fd9f4
child 16085 3d10c55e0ec2999b98921db4ae6e3fa34b9d073c
push id48
push usermbanner@mozilla.com
push dateThu, 13 Mar 2014 13:32:05 +0000
bugs919247
Bug 919247 - crash in nsMsgDBView::SetThreadIgnored(nsIMsgThread*, unsigned int, bool). r+a=standard8
mailnews/base/src/nsMsgDBView.cpp
--- a/mailnews/base/src/nsMsgDBView.cpp
+++ b/mailnews/base/src/nsMsgDBView.cpp
@@ -6965,28 +6965,32 @@ nsresult nsMsgDBView::SetThreadIgnored(n
   NoteChange(threadIndex, 1, nsMsgViewNotificationCode::changed);
   if (ignored)
   {
     nsTArray<nsMsgKey> idsMarkedRead;
 
     MarkThreadRead(thread, threadIndex, idsMarkedRead, true);
     CollapseByIndex(threadIndex, nullptr);
   }
+
+  if (!m_db)
+    return NS_ERROR_FAILURE;
   return m_db->MarkThreadIgnored(thread, m_keys[threadIndex], ignored, this);
 }
 
 nsresult nsMsgDBView::SetSubthreadKilled(nsIMsgDBHdr *header, nsMsgViewIndex msgIndex, bool ignored)
 {
   if (!IsValidIndex(msgIndex))
     return NS_MSG_INVALID_DBVIEW_INDEX;
 
   NoteChange(msgIndex, 1, nsMsgViewNotificationCode::changed);
-  nsresult rv;
-
-  rv = m_db->MarkHeaderKilled(header, ignored, this);
+
+  if (!m_db)
+    return NS_ERROR_FAILURE;
+  nsresult rv = m_db->MarkHeaderKilled(header, ignored, this);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (ignored)
   {
     nsCOMPtr <nsIMsgThread> thread;
     nsresult rv;
     rv = GetThreadContainingMsgHdr(header, getter_AddRefs(thread));
     if (NS_FAILED(rv))