Bug 917515 - Check for null before checking the document. r=ehsan

This commit is contained in:
Blake Kaplan 2013-09-26 18:42:53 +02:00
parent c72a9507ac
commit 919570efe5

View File

@ -4383,7 +4383,7 @@ Selection::Collapse(nsINode* aParentNode, int32_t aOffset)
nsresult result;
nsRefPtr<nsPresContext> presContext = GetPresContext();
if (presContext->Document() != aParentNode->OwnerDoc())
if (!presContext || presContext->Document() != aParentNode->OwnerDoc())
return NS_ERROR_FAILURE;
// Delete all of the current ranges
@ -4624,7 +4624,7 @@ Selection::Extend(nsINode* aParentNode, int32_t aOffset)
return NS_ERROR_FAILURE;
nsRefPtr<nsPresContext> presContext = GetPresContext();
if (presContext->Document() != aParentNode->OwnerDoc())
if (!presContext || presContext->Document() != aParentNode->OwnerDoc())
return NS_ERROR_FAILURE;
//mFrameSelection->InvalidateDesiredX();