forked from qt-creator/qt-creator
fix crash on files with no indented lines
This commit is contained in:
committed by
Thorbjørn Lindeijer
parent
d330320fc7
commit
e64c255b7e
@@ -234,8 +234,10 @@ 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) {
|
||||||
currentBlocks[0] = currentBlocks.at(0).previous();
|
if (currentBlocks.at(0).isValid())
|
||||||
currentBlocks[1] = currentBlocks.at(1).next();
|
currentBlocks[0] = currentBlocks.at(0).previous();
|
||||||
|
if (currentBlocks.at(1).isValid())
|
||||||
|
currentBlocks[1] = currentBlocks.at(1).next();
|
||||||
bool done = true;
|
bool done = true;
|
||||||
foreach(QTextBlock block, currentBlocks) {
|
foreach(QTextBlock block, currentBlocks) {
|
||||||
if (block.isValid())
|
if (block.isValid())
|
||||||
|
|||||||
Reference in New Issue
Block a user