Make nsContinuingTextFrame::GetFirstInFlow not crash. b=189515 r+sr=bzbarsky

git-svn-id: svn://10.0.0.236/trunk@136597 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dbaron%dbaron.org 2003-01-18 15:21:33 +00:00
parent 725aacf0d2
commit e44c2a9f95
2 changed files with 16 additions and 10 deletions

View File

@ -966,11 +966,14 @@ nsContinuingTextFrame::Destroy(nsIPresContext* aPresContext)
nsIFrame*
nsContinuingTextFrame::GetFirstInFlow() const
{
nsContinuingTextFrame* firstInFlow = (nsContinuingTextFrame*)this;
while (firstInFlow->mPrevInFlow) {
firstInFlow = (nsContinuingTextFrame*)firstInFlow->mPrevInFlow;
}
NS_POSTCONDITION(firstInFlow, "illegal state in flow chain.");
// Can't cast to |nsContinuingTextFrame*| because the first one isn't.
nsIFrame *firstInFlow,
*previous = NS_CONST_CAST(nsIFrame*,
NS_STATIC_CAST(const nsIFrame*, this));
do {
firstInFlow = previous;
firstInFlow->GetPrevInFlow(&previous);
} while (previous);
return firstInFlow;
}

View File

@ -966,11 +966,14 @@ nsContinuingTextFrame::Destroy(nsIPresContext* aPresContext)
nsIFrame*
nsContinuingTextFrame::GetFirstInFlow() const
{
nsContinuingTextFrame* firstInFlow = (nsContinuingTextFrame*)this;
while (firstInFlow->mPrevInFlow) {
firstInFlow = (nsContinuingTextFrame*)firstInFlow->mPrevInFlow;
}
NS_POSTCONDITION(firstInFlow, "illegal state in flow chain.");
// Can't cast to |nsContinuingTextFrame*| because the first one isn't.
nsIFrame *firstInFlow,
*previous = NS_CONST_CAST(nsIFrame*,
NS_STATIC_CAST(const nsIFrame*, this));
do {
firstInFlow = previous;
firstInFlow->GetPrevInFlow(&previous);
} while (previous);
return firstInFlow;
}