Fix for bug #4824. Added NULL pointer checks in GoToAnchor()

This commit is contained in:
troy%netscape.com 1999-04-09 04:28:15 +00:00
parent 739bea1432
commit a4baddf3dc
2 changed files with 4 additions and 4 deletions

View File

@ -1448,7 +1448,7 @@ PresShell::GoToAnchor(const nsString& aAnchorName) const
// Find the element with the specified id
rv = htmlDoc->GetElementById(aAnchorName, getter_AddRefs(element));
if (NS_SUCCEEDED(rv)) {
if (NS_SUCCEEDED(rv) && element) {
// Get the nsIContent interface, because that's what we need to
// get the primary frame
rv = element->QueryInterface(kIContentIID, getter_AddRefs(content));
@ -1459,7 +1459,7 @@ PresShell::GoToAnchor(const nsString& aAnchorName) const
rv = xmlDoc->GetContentById(aAnchorName, getter_AddRefs(content));
}
if (NS_SUCCEEDED(rv)) {
if (NS_SUCCEEDED(rv) && content) {
nsIFrame* frame;
// Get the primary frame

View File

@ -1448,7 +1448,7 @@ PresShell::GoToAnchor(const nsString& aAnchorName) const
// Find the element with the specified id
rv = htmlDoc->GetElementById(aAnchorName, getter_AddRefs(element));
if (NS_SUCCEEDED(rv)) {
if (NS_SUCCEEDED(rv) && element) {
// Get the nsIContent interface, because that's what we need to
// get the primary frame
rv = element->QueryInterface(kIContentIID, getter_AddRefs(content));
@ -1459,7 +1459,7 @@ PresShell::GoToAnchor(const nsString& aAnchorName) const
rv = xmlDoc->GetContentById(aAnchorName, getter_AddRefs(content));
}
if (NS_SUCCEEDED(rv)) {
if (NS_SUCCEEDED(rv) && content) {
nsIFrame* frame;
// Get the primary frame