diff --git a/mailnews/base/src/nsMsgGroupThread.cpp b/mailnews/base/src/nsMsgGroupThread.cpp index eec1fd41c2..e933120c3a 100644 --- a/mailnews/base/src/nsMsgGroupThread.cpp +++ b/mailnews/base/src/nsMsgGroupThread.cpp @@ -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 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) { diff --git a/mailnews/base/src/nsMsgXFViewThread.cpp b/mailnews/base/src/nsMsgXFViewThread.cpp index 12d83c5783..18f9f63f09 100644 --- a/mailnews/base/src/nsMsgXFViewThread.cpp +++ b/mailnews/base/src/nsMsgXFViewThread.cpp @@ -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 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 diff --git a/mailnews/db/msgdb/src/nsMsgThread.cpp b/mailnews/db/msgdb/src/nsMsgThread.cpp index 64d4d16b26..96409074bf 100644 --- a/mailnews/db/msgdb/src/nsMsgThread.cpp +++ b/mailnews/db/msgdb/src/nsMsgThread.cpp @@ -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 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) {