fixed a small bug. mRefNode may be nsnull.

This commit is contained in:
buster%netscape.com 1999-03-12 02:27:48 +00:00
parent 6f4ea05832
commit 9450d290ae
2 changed files with 6 additions and 2 deletions

View File

@ -142,7 +142,9 @@ NS_IMETHODIMP CreateElementTxn::Undo(void)
nsresult selectionResult = mEditor->GetSelection(getter_AddRefs(selection));
if (NS_SUCCEEDED(selectionResult) && selection) {
PRInt32 offset=0;
nsIEditorSupport::GetChildOffset(mRefNode, mParent, offset);
if (mRefNode) {
nsIEditorSupport::GetChildOffset(mRefNode, mParent, offset);
}
selectionResult = selection->Collapse(mParent, offset);
NS_ASSERTION((NS_SUCCEEDED(selectionResult)), "selection could not be collapsed after undo of insert.");
}

View File

@ -142,7 +142,9 @@ NS_IMETHODIMP CreateElementTxn::Undo(void)
nsresult selectionResult = mEditor->GetSelection(getter_AddRefs(selection));
if (NS_SUCCEEDED(selectionResult) && selection) {
PRInt32 offset=0;
nsIEditorSupport::GetChildOffset(mRefNode, mParent, offset);
if (mRefNode) {
nsIEditorSupport::GetChildOffset(mRefNode, mParent, offset);
}
selectionResult = selection->Collapse(mParent, offset);
NS_ASSERTION((NS_SUCCEEDED(selectionResult)), "selection could not be collapsed after undo of insert.");
}