bug 112182 - check for null pointers, sr=attinasi, r=bernd.

This commit is contained in:
karnaze%netscape.com 2001-11-29 15:55:27 +00:00
Родитель 0f8b8afa37
Коммит 657d552367
2 изменённых файлов: 20 добавлений и 8 удалений

Просмотреть файл

@ -1664,23 +1664,30 @@ NS_METHOD nsTableOuterFrame::VerifyTree() const
void nsTableOuterFrame::DeleteChildsNextInFlow(nsIPresContext* aPresContext, void nsTableOuterFrame::DeleteChildsNextInFlow(nsIPresContext* aPresContext,
nsIFrame* aChild) nsIFrame* aChild)
{ {
if (!aChild) return;
NS_PRECONDITION(mFrames.ContainsFrame(aChild), "bad geometric parent"); NS_PRECONDITION(mFrames.ContainsFrame(aChild), "bad geometric parent");
nsIFrame* nextInFlow; nsIFrame* nextInFlow;
aChild->GetNextInFlow(&nextInFlow); aChild->GetNextInFlow(&nextInFlow);
NS_PRECONDITION(nsnull != nextInFlow, "null next-in-flow"); if (!nextInFlow) {
NS_ASSERTION(PR_FALSE, "null next-in-flow");
return;
}
nsTableOuterFrame* parent; nsTableOuterFrame* parent;
nextInFlow->GetParent((nsIFrame**)&parent); nextInFlow->GetParent((nsIFrame**)&parent);
if (!parent) {
NS_ASSERTION(PR_FALSE, "null parent");
return;
}
// If the next-in-flow has a next-in-flow then delete it too (and // If the next-in-flow has a next-in-flow then delete it too (and
// delete it first). // delete it first).
nsIFrame* nextNextInFlow; nsIFrame* nextNextInFlow;
nextInFlow->GetNextInFlow(&nextNextInFlow); nextInFlow->GetNextInFlow(&nextNextInFlow);
if (nsnull != nextNextInFlow) { if (nextNextInFlow) {
parent->DeleteChildsNextInFlow(aPresContext, nextInFlow); parent->DeleteChildsNextInFlow(aPresContext, nextInFlow);
} }
@ -1692,7 +1699,6 @@ void nsTableOuterFrame::DeleteChildsNextInFlow(nsIPresContext* aPresContext,
nsIFrame* nextSibling; nsIFrame* nextSibling;
nextInFlow->GetNextSibling(&nextSibling); nextInFlow->GetNextSibling(&nextSibling);
parent->mFrames.SetFrames(nextSibling); parent->mFrames.SetFrames(nextSibling);
} else { } else {
nsIFrame* nextSibling; nsIFrame* nextSibling;

Просмотреть файл

@ -1664,23 +1664,30 @@ NS_METHOD nsTableOuterFrame::VerifyTree() const
void nsTableOuterFrame::DeleteChildsNextInFlow(nsIPresContext* aPresContext, void nsTableOuterFrame::DeleteChildsNextInFlow(nsIPresContext* aPresContext,
nsIFrame* aChild) nsIFrame* aChild)
{ {
if (!aChild) return;
NS_PRECONDITION(mFrames.ContainsFrame(aChild), "bad geometric parent"); NS_PRECONDITION(mFrames.ContainsFrame(aChild), "bad geometric parent");
nsIFrame* nextInFlow; nsIFrame* nextInFlow;
aChild->GetNextInFlow(&nextInFlow); aChild->GetNextInFlow(&nextInFlow);
NS_PRECONDITION(nsnull != nextInFlow, "null next-in-flow"); if (!nextInFlow) {
NS_ASSERTION(PR_FALSE, "null next-in-flow");
return;
}
nsTableOuterFrame* parent; nsTableOuterFrame* parent;
nextInFlow->GetParent((nsIFrame**)&parent); nextInFlow->GetParent((nsIFrame**)&parent);
if (!parent) {
NS_ASSERTION(PR_FALSE, "null parent");
return;
}
// If the next-in-flow has a next-in-flow then delete it too (and // If the next-in-flow has a next-in-flow then delete it too (and
// delete it first). // delete it first).
nsIFrame* nextNextInFlow; nsIFrame* nextNextInFlow;
nextInFlow->GetNextInFlow(&nextNextInFlow); nextInFlow->GetNextInFlow(&nextNextInFlow);
if (nsnull != nextNextInFlow) { if (nextNextInFlow) {
parent->DeleteChildsNextInFlow(aPresContext, nextInFlow); parent->DeleteChildsNextInFlow(aPresContext, nextInFlow);
} }
@ -1692,7 +1699,6 @@ void nsTableOuterFrame::DeleteChildsNextInFlow(nsIPresContext* aPresContext,
nsIFrame* nextSibling; nsIFrame* nextSibling;
nextInFlow->GetNextSibling(&nextSibling); nextInFlow->GetNextSibling(&nextSibling);
parent->mFrames.SetFrames(nextSibling); parent->mFrames.SetFrames(nextSibling);
} else { } else {
nsIFrame* nextSibling; nsIFrame* nextSibling;