diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index ff93e730d010..cdc0c31c3496 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -1366,7 +1366,7 @@ PresShell::ScrollFrameIntoView(nsIFrame *aFrame, // XXX Deal with the case where there is a scrolled element, e.g., a // DIV in the middle... - while (closestView != scrolledView) { + while ((closestView != nsnull) && (closestView != scrolledView)) { nscoord x, y; // Update the offset diff --git a/layout/html/base/src/nsPresShell.cpp b/layout/html/base/src/nsPresShell.cpp index ff93e730d010..cdc0c31c3496 100644 --- a/layout/html/base/src/nsPresShell.cpp +++ b/layout/html/base/src/nsPresShell.cpp @@ -1366,7 +1366,7 @@ PresShell::ScrollFrameIntoView(nsIFrame *aFrame, // XXX Deal with the case where there is a scrolled element, e.g., a // DIV in the middle... - while (closestView != scrolledView) { + while ((closestView != nsnull) && (closestView != scrolledView)) { nscoord x, y; // Update the offset