Bug 1732549 - fix Crash using newsgroup after View > Threads > Unread. r=benc

Differential Revision: https://phabricator.services.mozilla.com/D126638

--HG--
extra : rebase_source : ea9fc7df3c32e2711ea81cbfa3d91aa72d6d9a18
This commit is contained in:
Magnus Melin 2021-09-27 11:35:11 +03:00
Родитель 3d20d4b62f
Коммит 68734a72f9
3 изменённых файлов: 6 добавлений и 11 удалений

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

@ -604,14 +604,12 @@ nsresult nsMsgGroupThread::GetChildHdrForKey(nsMsgKey desiredKey,
NS_IMETHODIMP nsMsgGroupThread::GetFirstUnreadChild(nsIMsgDBHdr** result) {
NS_ENSURE_ARG_POINTER(result);
nsresult rv = NS_OK;
uint32_t numChildren = 0;
GetNumChildren(&numChildren);
for (uint32_t childIndex = 0; childIndex < numChildren; childIndex++) {
nsCOMPtr<nsIMsgDBHdr> child;
rv = GetChildHdrAt(childIndex, getter_AddRefs(child));
nsresult rv = GetChildHdrAt(childIndex, getter_AddRefs(child));
if (NS_SUCCEEDED(rv) && child) {
nsMsgKey msgKey;
child->GetMessageKey(&msgKey);
@ -625,7 +623,7 @@ NS_IMETHODIMP nsMsgGroupThread::GetFirstUnreadChild(nsIMsgDBHdr** result) {
}
}
return rv;
return (*result) ? NS_OK : NS_ERROR_NULL_POINTER;
}
NS_IMETHODIMP nsMsgGroupThread::GetNewestMsgDate(uint32_t* aResult) {

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

@ -412,15 +412,13 @@ NS_IMETHODIMP
nsMsgXFViewThread::GetFirstUnreadChild(nsIMsgDBHdr** aResult) {
NS_ENSURE_ARG(aResult);
uint32_t numChildren;
nsresult rv = NS_OK;
GetNumChildren(&numChildren);
if ((int32_t)numChildren < 0) numChildren = 0;
for (uint32_t childIndex = 0; childIndex < numChildren; childIndex++) {
nsCOMPtr<nsIMsgDBHdr> child;
rv = GetChildHdrAt(childIndex, getter_AddRefs(child));
nsresult rv = GetChildHdrAt(childIndex, getter_AddRefs(child));
if (NS_SUCCEEDED(rv) && child) {
nsMsgKey msgKey;
child->GetMessageKey(&msgKey);
@ -437,7 +435,7 @@ nsMsgXFViewThread::GetFirstUnreadChild(nsIMsgDBHdr** aResult) {
}
}
return rv;
return (*aResult) ? NS_OK : NS_ERROR_NULL_POINTER;
}
NS_IMETHODIMP

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

@ -978,7 +978,6 @@ nsresult nsMsgThread::GetChildHdrForKey(nsMsgKey desiredKey,
NS_IMETHODIMP nsMsgThread::GetFirstUnreadChild(nsIMsgDBHdr** result) {
NS_ENSURE_ARG_POINTER(result);
nsresult rv = NS_OK;
uint8_t minLevel = 0xff;
uint32_t numChildren = 0;
@ -988,7 +987,7 @@ NS_IMETHODIMP nsMsgThread::GetFirstUnreadChild(nsIMsgDBHdr** result) {
for (uint32_t childIndex = 0; childIndex < numChildren; childIndex++) {
nsCOMPtr<nsIMsgDBHdr> child;
rv = GetChildHdrAt(childIndex, getter_AddRefs(child));
nsresult rv = GetChildHdrAt(childIndex, getter_AddRefs(child));
if (NS_SUCCEEDED(rv) && child) {
nsMsgKey msgKey;
child->GetMessageKey(&msgKey);
@ -1022,7 +1021,7 @@ NS_IMETHODIMP nsMsgThread::GetFirstUnreadChild(nsIMsgDBHdr** result) {
}
retHdr.forget(result);
return rv;
return (*result) ? NS_OK : NS_ERROR_NULL_POINTER;
}
NS_IMETHODIMP nsMsgThread::GetNewestMsgDate(uint32_t* aResult) {