Divelist: fix a crash when updating the preferences

Hitting apply in the preferences dialog causes a QList assert.
This led to DiveListView::reloadHeaderActions(), where
we have an out of range access.

Patch makes the column count match the header action count.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Lubomir I. Ivanov 2013-12-04 18:20:33 +02:00 committed by Dirk Hohndel
parent fc06a69c43
commit d7a19b318e

View file

@ -391,10 +391,9 @@ void DiveListView::reloadHeaderActions()
}
s.endGroup();
} else {
// Skip first QAction item ( static text Visible )
for(int i = 0; i < model()->columnCount(); i++) {
QString title = QString("%1").arg(model()->headerData(i, Qt::Horizontal).toString());
header()->actions()[i+1]->setText( title );
header()->actions()[i]->setText(title);
}
}
}