Bug 1216914 - Ignore folder not being set in nsMailDatabase::GetSummaryValid(). r=rkent a=jorgk
authorJorg K
Sat, 28 May 2016 09:04:14 +0200
changeset 24899 0fbf7043a8399ee9d8b0b02823d63286eb5be4e5
parent 24898 876e5702c9f45185ccf2ac83ea877d29e2317c54
child 24900 0bf35c0be66d100483be973a839bbe07226b44a6
push id1657
push userclokep@gmail.com
push dateMon, 06 Jun 2016 19:50:21 +0000
treeherdercomm-beta@9fac989284b5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrkent, jorgk
bugs1216914
Bug 1216914 - Ignore folder not being set in nsMailDatabase::GetSummaryValid(). r=rkent a=jorgk
mailnews/db/msgdb/src/nsMailDatabase.cpp
--- a/mailnews/db/msgdb/src/nsMailDatabase.cpp
+++ b/mailnews/db/msgdb/src/nsMailDatabase.cpp
@@ -104,18 +104,27 @@ NS_IMETHODIMP nsMailDatabase::GetSummary
   uint32_t version;
   m_dbFolderInfo->GetVersion(&version);
   if (GetCurVersion() != version)
   {
     *aResult = false;
     return NS_OK;
   }
   nsCOMPtr<nsIMsgPluggableStore> msgStore;
-  if (!m_folder)
-    return NS_ERROR_NULL_POINTER;
+  if (!m_folder) {
+    // If the folder is not set, we just return without checking the validity
+    // of the summary file. For now, this is an expected condition when the
+    // message database is being opened from a URL in 
+    // nsMailboxUrl::GetMsgHdrForKey() which calls
+    // nsMsgDBService::OpenMailDBFromFile() without a folder.
+    // Returning an error here would lead to the deletion of the MSF in the
+    // caller nsMsgDatabase::CheckForErrors().
+    *aResult = true;
+    return NS_OK;
+  }
   nsresult rv = m_folder->GetMsgStore(getter_AddRefs(msgStore));
   NS_ENSURE_SUCCESS(rv, rv);
   return msgStore->IsSummaryFileValid(m_folder, this, aResult);
 }
 
 NS_IMETHODIMP nsMailDatabase::SetSummaryValid(bool aValid)
 {
   nsMsgDatabase::SetSummaryValid(aValid);