Assert that index is valid

This commit is contained in:
Carl Schwan
2023-05-19 19:50:32 +00:00
committed by Tobias Fella
parent b254b4aa9b
commit c7caec894e

View File

@@ -462,6 +462,7 @@ static LinkPreviewer *emptyLinkPreview = new LinkPreviewer;
QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
{
Q_ASSERT(checkIndex(idx, QAbstractItemModel::CheckIndexOption::IndexIsValid));
const auto row = idx.row();
if (!m_currentRoom || row < 0 || row >= int(m_currentRoom->pendingEvents().size()) + m_currentRoom->timelineSize()) {