Handle invalid model indices gracefully
data() being called with an invalid model index seems to happen during normal operations here, with something in the proxy model chain not catching that case (due to a row being filtered out presumably?).
This commit is contained in:
committed by
Tobias Fella
parent
a02232dc19
commit
22694fe5e4
@@ -434,7 +434,9 @@ static LinkPreviewer *emptyLinkPreview = new LinkPreviewer;
|
||||
|
||||
QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
||||
{
|
||||
Q_ASSERT(checkIndex(idx, QAbstractItemModel::CheckIndexOption::IndexIsValid));
|
||||
if (!checkIndex(idx, QAbstractItemModel::CheckIndexOption::IndexIsValid)) {
|
||||
return {};
|
||||
}
|
||||
const auto row = idx.row();
|
||||
|
||||
if (!m_currentRoom || row < 0 || row >= int(m_currentRoom->pendingEvents().size()) + m_currentRoom->timelineSize()) {
|
||||
|
||||
Reference in New Issue
Block a user