Don't load data from invalid indices in MessageFilterModel
This commit is contained in:
@@ -54,8 +54,9 @@ bool MessageFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sour
|
|||||||
// Don't show state events that are not the first in a consecutive group on the
|
// Don't show state events that are not the first in a consecutive group on the
|
||||||
// same day as they will be grouped as a single delegate.
|
// same day as they will be grouped as a single delegate.
|
||||||
const bool notLastRow = sourceRow < sourceModel()->rowCount() - 1;
|
const bool notLastRow = sourceRow < sourceModel()->rowCount() - 1;
|
||||||
const bool previousEventIsState =
|
const bool previousEventIsState = notLastRow
|
||||||
sourceModel()->data(sourceModel()->index(sourceRow + 1, 0), MessageEventModel::DelegateTypeRole) == MessageEventModel::DelegateType::State;
|
? sourceModel()->data(sourceModel()->index(sourceRow + 1, 0), MessageEventModel::DelegateTypeRole) == MessageEventModel::DelegateType::State
|
||||||
|
: false;
|
||||||
const bool newDay = sourceModel()->data(sourceModel()->index(sourceRow, 0), MessageEventModel::ShowSectionRole).toBool();
|
const bool newDay = sourceModel()->data(sourceModel()->index(sourceRow, 0), MessageEventModel::ShowSectionRole).toBool();
|
||||||
if (eventType == MessageEventModel::State && notLastRow && previousEventIsState && !newDay) {
|
if (eventType == MessageEventModel::State && notLastRow && previousEventIsState && !newDay) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user