Bug 620394 crash [@ PresShell::GoToAnchor] if selectAnchor && xpointerResult && !sel

r+a=roc
This commit is contained in:
timeless@mozdev.org 2010-12-21 15:03:01 -08:00
Родитель 02637fbb62
Коммит c128a11438
1 изменённых файлов: 9 добавлений и 9 удалений

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

@ -3972,16 +3972,16 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, PRBool aScroll)
// Use a caret (collapsed selection) at the start of the anchor
sel->CollapseToStart();
}
}
if (selectAnchor && xpointerResult) {
// Select the rest (if any) of the ranges in XPointerResult
PRUint32 count, i;
xpointerResult->GetLength(&count);
for (i = 1; i < count; i++) { // jumpToRange is i = 0
nsCOMPtr<nsIDOMRange> range;
xpointerResult->Item(i, getter_AddRefs(range));
sel->AddRange(range);
if (selectAnchor && xpointerResult) {
// Select the rest (if any) of the ranges in XPointerResult
PRUint32 count, i;
xpointerResult->GetLength(&count);
for (i = 1; i < count; i++) { // jumpToRange is i = 0
nsCOMPtr<nsIDOMRange> range;
xpointerResult->Item(i, getter_AddRefs(range));
sel->AddRange(range);
}
}
}
// Selection is at anchor.