Bug 1787650 - Fix crash on null listener in IMAP compaction/expunge. r=mkmelin

Differential Revision: https://phabricator.services.mozilla.com/D155801
This commit is contained in:
Ben Campbell 2022-08-29 22:09:00 +00:00
Родитель f07b76a486
Коммит bbb6fec901
1 изменённых файлов: 12 добавлений и 3 удалений

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

@ -1264,7 +1264,10 @@ nsresult nsImapMailFolder::ExpungeAndCompact(nsIUrlListener* aListener,
nsCOMPtr<nsIMsgPluggableStore> msgStore;
nsresult rv = folder->GetMsgStore(getter_AddRefs(msgStore));
if (NS_FAILED(rv)) {
return finalListener->OnStopRunningUrl(nullptr, rv);
if (finalListener) {
return finalListener->OnStopRunningUrl(nullptr, rv);
}
return rv;
}
bool storeSupportsCompaction;
msgStore->GetSupportsCompaction(&storeSupportsCompaction);
@ -1272,13 +1275,19 @@ nsresult nsImapMailFolder::ExpungeAndCompact(nsIUrlListener* aListener,
nsCOMPtr<nsIMsgFolderCompactor> folderCompactor =
do_CreateInstance(NS_MSGFOLDERCOMPACTOR_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
return finalListener->OnStopRunningUrl(nullptr, rv);
if (finalListener) {
return finalListener->OnStopRunningUrl(nullptr, rv);
}
return rv;
}
return folderCompactor->CompactFolders({folder}, finalListener,
msgWindow);
}
// Not going to run a compaction, so signal that we're all done.
return finalListener->OnStopRunningUrl(nullptr, NS_OK);
if (finalListener) {
return finalListener->OnStopRunningUrl(nullptr, NS_OK);
}
return NS_OK;
};
if (WeAreOffline()) {