From af67a44147b1725532d5df1776cf1403330236b9 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Tue, 20 Feb 2024 19:56:55 +0400 Subject: [PATCH] A small simplification --- src/contentmanagermodel.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/contentmanagermodel.cpp b/src/contentmanagermodel.cpp index e9ebd0b..84c9cf7 100644 --- a/src/contentmanagermodel.cpp +++ b/src/contentmanagermodel.cpp @@ -27,13 +27,10 @@ int ContentManagerModel::columnCount(const QModelIndex &parent) const QVariant ContentManagerModel::data(const QModelIndex& index, int role) const { - if (!index.isValid()) - return QVariant(); - - auto item = static_cast(index.internalPointer()); const auto displayRole = role == Qt::DisplayRole; const auto additionalInfoRole = role == Qt::UserRole+1; - if (displayRole || additionalInfoRole) { + if ( (displayRole || additionalInfoRole) && index.isValid() ) { + const auto item = static_cast(index.internalPointer()); QVariant r = item->data(index.column()); if ( index.column() != 0 ) return r;