add some bulletproofing to the subscribe search view so that we

check the row.  fixes crasher bug #117065
r/sr=bienvenu
This commit is contained in:
sspitzer%netscape.com 2002-01-08 01:32:27 +00:00
Родитель 5965318acb
Коммит 2da5458bd8
2 изменённых файлов: 14 добавлений и 1 удалений

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

@ -1775,6 +1775,9 @@ nsNntpIncomingServer::GetRowProperties(PRInt32 index, nsISupportsArray *properti
NS_IMETHODIMP
nsNntpIncomingServer::GetCellProperties(PRInt32 row, const PRUnichar *colID, nsISupportsArray *properties)
{
if (!IsValidRow(row))
return NS_ERROR_UNEXPECTED;
if (colID[0] == 's') {
// if <name> is in our temporary list of subscribed groups
// add the "subscribed" property so the check mark shows up
@ -1868,9 +1871,18 @@ nsNntpIncomingServer::GetLevel(PRInt32 index, PRInt32 *_retval)
return NS_OK;
}
nsresult
nsNntpIncomingServer::IsValidRow(PRInt32 row)
{
return ((row >= 0) && (row < mSubscribeSearchResult.Count()));
}
NS_IMETHODIMP
nsNntpIncomingServer::GetCellText(PRInt32 row, const PRUnichar *colID, nsAString& _retval)
{
if (!IsValidRow(row))
return NS_ERROR_UNEXPECTED;
if (colID[0] == 'n') {
nsCString str;
mSubscribeSearchResult.CStringAt(row, str);

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

@ -154,7 +154,8 @@ private:
nsCOMPtr <nsISubscribableServer> mInner;
nsresult EnsureInner();
nsresult ClearInner();
nsresult IsValidRow(PRInt32 row);
nsIOFileStream *mHostInfoStream;
nsCOMPtr<nsIFileSpec> mNewsrcFilePath;
};