Bug 646901 - add error checking to fix crash in nsMsgXFVirtualFolderDBView::OnSearchHit(). r=jorgk

dbToUse was null
This commit is contained in:
Magnus Melin 2018-09-28 14:35:12 +03:00
Родитель 7bc796e03e
Коммит 6ef572320d
1 изменённых файлов: 8 добавлений и 7 удалений

Просмотреть файл

@ -280,10 +280,6 @@ nsMsgXFVirtualFolderDBView::OnSearchHit(nsIMsgDBHdr* aMsgHdr,
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;
@ -297,11 +293,16 @@ nsMsgXFVirtualFolderDBView::OnSearchHit(nsIMsgDBHdr* aMsgHdr,
}
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)