From c31cab34e426441c0e50959187434860be7a9cba Mon Sep 17 00:00:00 2001 From: Pascal Sander Date: Sun, 17 Aug 2025 10:33:04 +0200 Subject: [PATCH] Check QAbstractItemModel for nullptr before access. #2 --- sources/ElementsCollection/elementscollectionmodel.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sources/ElementsCollection/elementscollectionmodel.cpp b/sources/ElementsCollection/elementscollectionmodel.cpp index 7e28f678e..b7305ffaa 100644 --- a/sources/ElementsCollection/elementscollectionmodel.cpp +++ b/sources/ElementsCollection/elementscollectionmodel.cpp @@ -172,10 +172,12 @@ bool ElementsCollectionModel::dropMimeData(const QMimeData *data, const QModelIndex &parent) { Q_UNUSED(action) - QStandardItem *qsi = itemFromIndex( - parent.QModelIndex::model()->index(row, column)); - if (!qsi) - qsi = itemFromIndex(parent); + + const QAbstractItemModel* qaim = parent.QModelIndex::model(); + if (! qaim) return false; + + QStandardItem* qsi = itemFromIndex(qaim->index(row, column)); + if (! qsi) qsi = itemFromIndex(parent); if (qsi->type() == FileElementCollectionItem::Type) {