summaryrefslogtreecommitdiffstats
path: root/mailnews/base
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2019-11-10 19:17:09 -0500
committerMatt A. Tobin <email@mattatobin.com>2019-11-10 19:17:09 -0500
commit818c1df5ef6ecd9648189cc5ff7b2c3d8d26ad9b (patch)
tree17085586b3e648e39eff24f5b26cb043656d026e /mailnews/base
parent201683afe4596ae32f7b1ea12dfca52995d59f9d (diff)
downloadUXP-818c1df5ef6ecd9648189cc5ff7b2c3d8d26ad9b.tar
UXP-818c1df5ef6ecd9648189cc5ff7b2c3d8d26ad9b.tar.gz
UXP-818c1df5ef6ecd9648189cc5ff7b2c3d8d26ad9b.tar.lz
UXP-818c1df5ef6ecd9648189cc5ff7b2c3d8d26ad9b.tar.xz
UXP-818c1df5ef6ecd9648189cc5ff7b2c3d8d26ad9b.zip
Bug 646901 - add error checking to fix crash in nsMsgXFVirtualFolderDBView::OnSearchHit().
dbToUse was null Rag #1273
Diffstat (limited to 'mailnews/base')
-rw-r--r--mailnews/base/src/nsMsgXFVirtualFolderDBView.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/mailnews/base/src/nsMsgXFVirtualFolderDBView.cpp b/mailnews/base/src/nsMsgXFVirtualFolderDBView.cpp
index cdc4f0b5a..61dbca56e 100644
--- a/mailnews/base/src/nsMsgXFVirtualFolderDBView.cpp
+++ b/mailnews/base/src/nsMsgXFVirtualFolderDBView.cpp
@@ -251,10 +251,6 @@ nsMsgXFVirtualFolderDBView::OnSearchHit(nsIMsgDBHdr* aMsgHdr, nsIMsgFolder *aFol
NS_ENSURE_ARG(aMsgHdr);
NS_ENSURE_ARG(aFolder);
- nsCOMPtr<nsIMsgDatabase> dbToUse;
- nsCOMPtr<nsIDBFolderInfo> folderInfo;
- aFolder->GetDBFolderInfoAndDB(getter_AddRefs(folderInfo), getter_AddRefs(dbToUse));
-
if (m_curFolderGettingHits != aFolder && m_doingSearch && !m_doingQuickSearch)
{
m_curFolderHasCachedHits = false;
@@ -267,11 +263,16 @@ nsMsgXFVirtualFolderDBView::OnSearchHit(nsIMsgDBHdr* aMsgHdr, nsIMsgFolder *aFol
m_curFolderStartKeyIndex = m_keys.Length();
}
bool hdrInCache = false;
- nsCString searchUri;
if (!m_doingQuickSearch)
{
- m_viewFolder->GetURI(searchUri);
- dbToUse->HdrIsInCache(searchUri.get(), aMsgHdr, &hdrInCache);
+ nsCOMPtr<nsIMsgDatabase> dbToUse;
+ nsCOMPtr<nsIDBFolderInfo> dummyInfo;
+ nsresult rv = aFolder->GetDBFolderInfoAndDB(getter_AddRefs(dummyInfo), getter_AddRefs(dbToUse));
+ if (NS_SUCCEEDED(rv)) {
+ nsCString searchUri;
+ m_viewFolder->GetURI(searchUri);
+ dbToUse->HdrIsInCache(searchUri.get(), aMsgHdr, &hdrInCache);
+ }
}
if (!m_doingSearch || !m_curFolderHasCachedHits || !hdrInCache)
{