Add a null check to avoid crashing when typing in the profile window text fields.

This commit is contained in:
sfraser%netscape.com 1999-06-20 00:15:40 +00:00
Родитель d7a49fad32
Коммит 71b0c91df9
1 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -1083,10 +1083,16 @@ nsRangeList::GetPrimaryFrameForFocusNode(nsIFrame **aReturnFrame)
{
if (!aReturnFrame)
return NS_ERROR_NULL_POINTER;
nsresult result = NS_OK;
nsCOMPtr<nsIDOMNode> node = dont_QueryInterface(FetchFocusNode());
nsCOMPtr<nsIContent> content = do_QueryInterface(node);
nsCOMPtr<nsIContent> content = do_QueryInterface(node, &result);
if (NS_FAILED(result) || !content)
return result;
PRBool canContainChildren = PR_FALSE;
nsresult result = content->CanContainChildren(canContainChildren);
result = content->CanContainChildren(canContainChildren);
if (NS_SUCCEEDED(result) && canContainChildren)
{
PRInt32 offset = FetchFocusOffset();