зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
d6d068c6d4
Коммит
6bcec5ddcb
|
@ -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.
|
||||
|
|
Загрузка…
Ссылка в новой задаче