Bug 574558 - Part 2: Don't fail if we can't get the selection to adjust it after removing elements; r=roc

This commit is contained in:
Ehsan Akhgari 2010-06-28 14:04:37 -04:00
parent 464f08a611
commit 5ae8a4993e

View File

@ -204,7 +204,11 @@ NS_IMETHODIMP DeleteRangeTxn::DoTransaction(void)
{
nsCOMPtr<nsISelection> 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);
}