From 63630831d8749f9a938ba01a5b05abe8e2df5165 Mon Sep 17 00:00:00 2001 From: "radha%netscape.com" Date: Wed, 10 Apr 2002 14:04:02 +0000 Subject: [PATCH] Fix for bug # 135868. Null pointer reference in nsDocShell::InternalLoad. r=mcafee sr=rpotts a=valeski. Approved by ADT. git-svn-id: svn://10.0.0.236/trunk@118620 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsDocShell.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index a53828896a7..d02919a23cd 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -4575,7 +4575,8 @@ nsDocShell::InternalLoad(nsIURI * aURI, OnNewURI(aURI, nsnull, mLoadType); /* save current position of scroller(s) (bug 59774) */ - mOSHE->SetScrollPosition(cx, cy); + if (mOSHE) + mOSHE->SetScrollPosition(cx, cy); /* If this is a history load, OnNewURI() will not create * a mLSHE. In that case, we want to assign mOSHE to aSHEntry @@ -4583,18 +4584,18 @@ nsDocShell::InternalLoad(nsIURI * aURI, * be assigned to mOSHE. */ if (aSHEntry && !mLSHE) - mOSHE = aSHEntry; + mOSHE = aSHEntry; else if (mLSHE) - mOSHE = mLSHE; + mOSHE = mLSHE; /* restore previous position of scroller(s), if we're moving * back in history (bug 59774) */ - if (aLoadType == LOAD_HISTORY) + if (aLoadType == LOAD_HISTORY && mOSHE) { - nscoord bx, by; - mOSHE->GetScrollPosition(&bx, &by); - SetCurScrollPosEx(bx, by); + nscoord bx, by; + mOSHE->GetScrollPosition(&bx, &by); + SetCurScrollPosEx(bx, by); } /* Clear out mLSHE so that further anchor visits get