fix for bug 5782 - check for null return when getting prev/next node is deletion rules; rvd floppy moose, appr chofmann

git-svn-id: svn://10.0.0.236/trunk@29950 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jfrancis%netscape.com 1999-05-01 19:37:50 +00:00
parent 6ad4ff2140
commit e1f400aecd
2 changed files with 30 additions and 6 deletions

View File

@ -367,6 +367,13 @@ nsHTMLEditRules::WillDeleteSelection(nsIDOMSelection *aSelection, nsIEditor::Dir
res = GetPriorNode(node, getter_AddRefs(priorNode));
if (NS_FAILED(res)) return res;
// if there is no prior node then cancel the deletion
if (!priorNode)
{
*aCancel = PR_TRUE;
return res;
}
// XXX hackery - using this to skip empty text nodes,
// since these are almost always non displayed preservation
// of returns in the original html. but they could
@ -423,9 +430,14 @@ nsHTMLEditRules::WillDeleteSelection(nsIDOMSelection *aSelection, nsIEditor::Dir
nsCOMPtr<nsIDOMNode> nextNode;
res = GetNextNode(node, getter_AddRefs(nextNode));
if (NS_FAILED(res)) return res;
if (HasSameBlockNodeParent(node, nextNode)) return NS_OK;
// deleting across blocks
// if there is no next node then cancel the deletion
if (!nextNode)
{
*aCancel = PR_TRUE;
return res;
}
// XXX hackery - using this to skip empty text nodes,
// since these are almost always non displayed preservation
// of returns in the original html. but they could

View File

@ -367,6 +367,13 @@ nsHTMLEditRules::WillDeleteSelection(nsIDOMSelection *aSelection, nsIEditor::Dir
res = GetPriorNode(node, getter_AddRefs(priorNode));
if (NS_FAILED(res)) return res;
// if there is no prior node then cancel the deletion
if (!priorNode)
{
*aCancel = PR_TRUE;
return res;
}
// XXX hackery - using this to skip empty text nodes,
// since these are almost always non displayed preservation
// of returns in the original html. but they could
@ -423,9 +430,14 @@ nsHTMLEditRules::WillDeleteSelection(nsIDOMSelection *aSelection, nsIEditor::Dir
nsCOMPtr<nsIDOMNode> nextNode;
res = GetNextNode(node, getter_AddRefs(nextNode));
if (NS_FAILED(res)) return res;
if (HasSameBlockNodeParent(node, nextNode)) return NS_OK;
// deleting across blocks
// if there is no next node then cancel the deletion
if (!nextNode)
{
*aCancel = PR_TRUE;
return res;
}
// XXX hackery - using this to skip empty text nodes,
// since these are almost always non displayed preservation
// of returns in the original html. but they could