diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 74a0cc210f..14c8e9e906 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -2986,7 +2986,7 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, bool aScroll, } // Search for an anchor element with a matching "name" attribute - if (!content && htmlDoc) { + if (!content && htmlDoc && mDocument) { // Find a matching list of named nodes nsCOMPtr list = mDocument->GetElementsByName(aAnchorName); if (list) {