Bug 1208884 - Fix a few null check ordering bugs in nsHTMLEditRules::SplitParagraph; r=roc

Found by Viva64.
This commit is contained in:
Ehsan Akhgari 2015-09-27 15:51:37 -04:00
parent 74504dc15a
commit ed270af4ab

View File

@ -6590,7 +6590,8 @@ nsHTMLEditRules::SplitParagraph(nsIDOMNode *aPara,
nsCOMPtr<nsIDOMNode> child =
GetAsDOMNode(mHTMLEditor->GetLeftmostChild(rightParaNode, true));
NS_ENSURE_STATE(mHTMLEditor);
if (mHTMLEditor->IsTextNode(child) || !mHTMLEditor ||
if (!mHTMLEditor ||
mHTMLEditor->IsTextNode(child) ||
mHTMLEditor->IsContainer(child))
{
NS_ENSURE_STATE(mHTMLEditor);
@ -7389,7 +7390,8 @@ nsHTMLEditRules::PinSelectionToNewBlock(Selection* aSelection)
tmp = GetAsDOMNode(mHTMLEditor->GetLastEditableChild(*block));
uint32_t endPoint;
NS_ENSURE_STATE(mHTMLEditor);
if (mHTMLEditor->IsTextNode(tmp) || !mHTMLEditor ||
if (!mHTMLEditor ||
mHTMLEditor->IsTextNode(tmp) ||
mHTMLEditor->IsContainer(tmp))
{
NS_ENSURE_STATE(mHTMLEditor);
@ -7410,7 +7412,8 @@ nsHTMLEditRules::PinSelectionToNewBlock(Selection* aSelection)
NS_ENSURE_STATE(mHTMLEditor);
tmp = GetAsDOMNode(mHTMLEditor->GetFirstEditableChild(*block));
int32_t offset;
if (!(mHTMLEditor->IsTextNode(tmp) || !mHTMLEditor ||
if (mHTMLEditor &&
!(mHTMLEditor->IsTextNode(tmp) ||
mHTMLEditor->IsContainer(tmp)))
{
tmp = nsEditor::GetNodeLocation(tmp, &offset);