s[r]=mscott
Avoid malloc of 0 - if there are no items to sort, don't try to sort them.
This commit is contained in:
mkaply%us.ibm.com 2001-07-24 22:43:01 +00:00
Родитель d6d068c6d4
Коммит 6bcec5ddcb
3 изменённых файлов: 10 добавлений и 0 удалений

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

@ -2199,6 +2199,10 @@ NS_IMETHODIMP nsMsgDBView::Sort(nsMsgViewSortTypeValue sortType, nsMsgViewSortOr
nsVoidArray ptrs;
PRUint32 arraySize = GetSize();
if (!arraySize) {
return NS_OK;
} /* endif */
nsCOMPtr <nsISupportsArray> folders;
GetFolders(getter_AddRefs(folders));

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

@ -417,6 +417,9 @@ NS_IMETHODIMP nsMsgSearchDBView::Sort(nsMsgViewSortTypeValue sortType, nsMsgView
SaveSelection(&preservedSelection);
PRInt32 rowCountBeforeSort = GetSize();
if (!rowCountBeforeSort)
return NS_OK;
rv = nsMsgDBView::Sort(sortType,sortOrder);
// the sort may have changed the number of rows

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

@ -132,6 +132,9 @@ NS_IMETHODIMP nsMsgThreadedDBView::Sort(nsMsgViewSortTypeValue sortType, nsMsgVi
PRInt32 rowCountBeforeSort = GetSize();
if (!rowCountBeforeSort)
return NS_OK;
// if the client wants us to forget our cached id arrays, they
// should build a new view. If this isn't good enough, we
// need a method to do that.