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:
committed by
Dirk Hohndel
parent
fc06a69c43
commit
d7a19b318e
@@ -391,10 +391,9 @@ void DiveListView::reloadHeaderActions()
|
|||||||
}
|
}
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
} else {
|
} else {
|
||||||
// Skip first QAction item ( static text Visible )
|
|
||||||
for(int i = 0; i < model()->columnCount(); i++) {
|
for(int i = 0; i < model()->columnCount(); i++) {
|
||||||
QString title = QString("%1").arg(model()->headerData(i, Qt::Horizontal).toString());
|
QString title = QString("%1").arg(model()->headerData(i, Qt::Horizontal).toString());
|
||||||
header()->actions()[i+1]->setText( title );
|
header()->actions()[i]->setText(title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user