From e97bd96b3ad67cfa164671790ffcae8842f0631d Mon Sep 17 00:00:00 2001 From: "uriber@gmail.com" Date: Sat, 23 Feb 2008 02:54:29 -0800 Subject: [PATCH] Add a comment and assertion to the fix for bug 370174. r+sr=roc on the original patch. blocking1.9=dbaron --- layout/generic/nsFrame.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index c010ae95a458..34812d15b738 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -4519,6 +4519,7 @@ FindBlockFrameOrBR(nsIFrame* aFrame, nsDirection aDirection) { nsContentAndOffset result; result.mContent = nsnull; + result.mOffset = 0; if (aFrame->IsGeneratedContentFrame()) return result; @@ -4540,6 +4541,10 @@ FindBlockFrameOrBR(nsIFrame* aFrame, nsDirection aDirection) aFrame->GetType() == nsGkAtoms::brFrame) { nsIContent* content = aFrame->GetContent(); result.mContent = content->GetParent(); + // In some cases (bug 310589, bug 370174) we end up here with a null content. + // This probably shouldn't ever happen, but since it sometimes does, we want + // to avoid crashing here. + NS_ASSERTION(result.mContent, "Unexpected orphan content"); if (result.mContent) result.mOffset = result.mContent->IndexOf(content) + (aDirection == eDirPrevious ? 1 : 0);