Follow up to crash fix for bug 240397.

This commit is contained in:
mozilla.mano@sent.com 2007-05-29 12:44:26 -07:00
Родитель b3e1249f4c
Коммит 31e4547ce2
1 изменённых файлов: 14 добавлений и 12 удалений

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

@ -490,19 +490,21 @@ nsNavHistory::AutoCompleteFullHistorySearch(const nsAString& aSearchString,
AUTOCOMPLETE_MATCHES_SCHEME_PENALTY, &matches);
}
// sort according to priorities
AutoCompleteResultComparator comparator(this);
matches.Sort(comparator);
// fill into result
rv = aResult->AppendMatch(matches[0].url, matches[0].title);
NS_ENSURE_SUCCESS(rv, rv);
for (i = 1; i < matches.Length(); i ++) {
// only add ones that are NOT the same as the previous one. It's possible
// to get duplicates from the queries.
if (!matches[i].url.Equals(matches[i-1].url)) {
rv = aResult->AppendMatch(matches[i].url, matches[i].title);
NS_ENSURE_SUCCESS(rv, rv);
if (matches.Length() > 0) {
// sort according to priorities
AutoCompleteResultComparator comparator(this);
matches.Sort(comparator);
rv = aResult->AppendMatch(matches[0].url, matches[0].title);
NS_ENSURE_SUCCESS(rv, rv);
for (i = 1; i < matches.Length(); i ++) {
// only add ones that are NOT the same as the previous one. It's possible
// to get duplicates from the queries.
if (!matches[i].url.Equals(matches[i-1].url)) {
rv = aResult->AppendMatch(matches[i].url, matches[i].title);
NS_ENSURE_SUCCESS(rv, rv);
}
}
}
return NS_OK;