From 5ae8a4993eab8a3f3363ae38c934fa982280dbb9 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Mon, 28 Jun 2010 14:04:37 -0400 Subject: [PATCH] Bug 574558 - Part 2: Don't fail if we can't get the selection to adjust it after removing elements; r=roc --- editor/libeditor/base/DeleteRangeTxn.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/editor/libeditor/base/DeleteRangeTxn.cpp b/editor/libeditor/base/DeleteRangeTxn.cpp index 5caa0927b3b4..58a5e8eb57ab 100644 --- a/editor/libeditor/base/DeleteRangeTxn.cpp +++ b/editor/libeditor/base/DeleteRangeTxn.cpp @@ -204,7 +204,11 @@ NS_IMETHODIMP DeleteRangeTxn::DoTransaction(void) { nsCOMPtr selection; result = mEditor->GetSelection(getter_AddRefs(selection)); - NS_ENSURE_SUCCESS(result, result); + // At this point, it is possible that the frame for our root element + // might have been destroyed, in which case, the above call returns + // an error. We eat that error here intentionally. See bug 574558 + // for a sample case where this happens. + NS_ENSURE_SUCCESS(result, NS_OK); NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER); result = selection->Collapse(mStartParent, mStartOffset); }