fix crash on files with no indented lines

This commit is contained in:
Roopesh Chander
2009-12-21 15:08:48 +05:30
committed by Thorbjørn Lindeijer
parent d330320fc7
commit e64c255b7e

View File

@@ -234,7 +234,9 @@ bool TabSettings::guessSpacesForTabs(const QTextBlock& _block) const {
QVector<QTextBlock> currentBlocks(2, _block); // [0] looks back; [1] looks forward QVector<QTextBlock> currentBlocks(2, _block); // [0] looks back; [1] looks forward
int maxLookAround = 100; int maxLookAround = 100;
while (maxLookAround-- > 0) { while (maxLookAround-- > 0) {
if (currentBlocks.at(0).isValid())
currentBlocks[0] = currentBlocks.at(0).previous(); currentBlocks[0] = currentBlocks.at(0).previous();
if (currentBlocks.at(1).isValid())
currentBlocks[1] = currentBlocks.at(1).next(); currentBlocks[1] = currentBlocks.at(1).next();
bool done = true; bool done = true;
foreach(QTextBlock block, currentBlocks) { foreach(QTextBlock block, currentBlocks) {