From 191b0d4768861ec4c23d3cfeb65e15b7ff36fc4e Mon Sep 17 00:00:00 2001 From: Martin Dobias Date: Thu, 10 May 2018 07:45:34 -0400 Subject: [PATCH] union: throw an exception if the second layer is specified but not valid --- src/analysis/processing/qgsalgorithmunion.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/analysis/processing/qgsalgorithmunion.cpp b/src/analysis/processing/qgsalgorithmunion.cpp index 8e4e7d12fc4..f16d56834d0 100644 --- a/src/analysis/processing/qgsalgorithmunion.cpp +++ b/src/analysis/processing/qgsalgorithmunion.cpp @@ -65,7 +65,8 @@ QVariantMap QgsUnionAlgorithm::processAlgorithm( const QVariantMap ¶meters, throw QgsProcessingException( invalidSourceError( parameters, QStringLiteral( "INPUT" ) ) ); std::unique_ptr< QgsFeatureSource > sourceB( parameterAsSource( parameters, QStringLiteral( "OVERLAY" ), context ) ); - // sourceB is optional so we do not throw an error if it is not a valid source + if ( parameters.value( QStringLiteral( "OVERLAY" ) ).isValid() && !sourceB ) + throw QgsProcessingException( invalidSourceError( parameters, QStringLiteral( "OVERLAY" ) ) ); QgsWkbTypes::Type geomType = QgsWkbTypes::multiType( sourceA->wkbType() );