fix for crash in bug #25339, r=hyatt. the problem is someone is trying to select a null

element in the tree (from js).  now, on to fix that problem.
This commit is contained in:
sspitzer%netscape.com 2000-01-28 01:30:29 +00:00
Родитель c7d4d2df98
Коммит 5f82aeba31
2 изменённых файлов: 12 добавлений и 0 удалений

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

@ -151,6 +151,9 @@ nsXULTreeElement::GetSelectedCells(nsIDOMNodeList** aSelectedCells)
NS_IMETHODIMP
nsXULTreeElement::SelectItem(nsIDOMXULElement* aTreeItem)
{
NS_ASSERTION(aTreeItem, "trying to select a null tree item");
if (!aTreeItem) return NS_OK;
// Sanity check. If we're the only item, just bail.
PRUint32 length;
mSelectedItems->GetLength(&length);
@ -251,6 +254,9 @@ nsXULTreeElement::ClearCellSelection()
void
nsXULTreeElement::AddItemToSelectionInternal(nsIDOMXULElement* aTreeItem)
{
NS_ASSERTION(aTreeItem,"attepting to add a null tree item to the selection");
if (!aTreeItem) return;
// Without clearing the selection, perform the add.
nsCOMPtr<nsIContent> content = do_QueryInterface(aTreeItem);
content->SetAttribute(kNameSpaceID_None, kSelectedAtom, nsAutoString("true"), PR_TRUE);

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

@ -151,6 +151,9 @@ nsXULTreeElement::GetSelectedCells(nsIDOMNodeList** aSelectedCells)
NS_IMETHODIMP
nsXULTreeElement::SelectItem(nsIDOMXULElement* aTreeItem)
{
NS_ASSERTION(aTreeItem, "trying to select a null tree item");
if (!aTreeItem) return NS_OK;
// Sanity check. If we're the only item, just bail.
PRUint32 length;
mSelectedItems->GetLength(&length);
@ -251,6 +254,9 @@ nsXULTreeElement::ClearCellSelection()
void
nsXULTreeElement::AddItemToSelectionInternal(nsIDOMXULElement* aTreeItem)
{
NS_ASSERTION(aTreeItem,"attepting to add a null tree item to the selection");
if (!aTreeItem) return;
// Without clearing the selection, perform the add.
nsCOMPtr<nsIContent> content = do_QueryInterface(aTreeItem);
content->SetAttribute(kNameSpaceID_None, kSelectedAtom, nsAutoString("true"), PR_TRUE);