From dd05acc2fbc4a55e65715b799810e37368cf83b0 Mon Sep 17 00:00:00 2001 From: Tomas Mizera Date: Fri, 19 Jul 2024 15:43:46 +0200 Subject: [PATCH] Fix invalid layer in value relation field --- app/featuresmodel.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/featuresmodel.cpp b/app/featuresmodel.cpp index 98cde7cbe..43c34f1b4 100644 --- a/app/featuresmodel.cpp +++ b/app/featuresmodel.cpp @@ -158,6 +158,12 @@ int FeaturesModel::rowCount( const QModelIndex &parent ) const QVariant FeaturesModel::featureTitle( const FeatureLayerPair &featurePair ) const { + if ( !featurePair.layer() || !featurePair.layer()->isValid() ) + { + CoreUtils::log( QStringLiteral( "Features Model" ), QStringLiteral( "Received invalid feature layer pair!" ) ); + return tr( "Unknown title" ); + } + QString title; QgsExpressionContext context( QgsExpressionContextUtils::globalProjectLayerScopes( featurePair.layer() ) );