Bug 368860. Don't perform out-of-bounds access if we have a bogus empty previous-text-frame. r+sr=dbaron

This commit is contained in:
roc+@cs.cmu.edu 2007-04-03 19:28:27 -07:00
Родитель cc74e411be
Коммит aa82e980a6
1 изменённых файлов: 5 добавлений и 2 удалений

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

@ -4996,9 +4996,12 @@ static PRBool CanBreakBetween(nsTextFrame* aBefore,
firstAfter = fragAfter->CharAt(afterOffset);
}
while (IS_DISCARDED(lastBefore)) {
NS_ASSERTION(beforeOffset > 0,
"Before-textframe maps no content, should not have called SetTrailingTextFrame");
--beforeOffset;
if (beforeOffset == 0) {
// aBefore was entirely skipped. Who knows why it called SetTrailingTextFrame.
NS_WARNING("Before-frame should not have called SetTrailingTextFrame");
return PR_FALSE;
}
lastBefore = fragBefore->CharAt(beforeOffset - 1);
}