Fix out of bounds crash in Theme selector (#998)

* Fix out of bounds crash in Theme selectors
This commit is contained in:
Itay Cohen 2018-12-12 19:10:29 +02:00 committed by xarkes
parent bc5d237d9b
commit 4026ea11a1

View File

@ -462,6 +462,14 @@ ColorSettingsModel::ColorSettingsModel(QObject *parent) : QAbstractListModel (pa
QVariant ColorSettingsModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid()) {
return QVariant();
}
if (index.row() < 0 || index.row() >= m_data.size()) {
return QVariant();
}
if (role == Qt::DisplayRole) {
return QVariant::fromValue(m_data.at(index.row()).displayingText);
}