Skip to content

Commit 191b0d4

Browse files
committed
union: throw an exception if the second layer is specified but not valid
1 parent 7df062b commit 191b0d4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/analysis/processing/qgsalgorithmunion.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ QVariantMap QgsUnionAlgorithm::processAlgorithm( const QVariantMap &parameters,
6565
throw QgsProcessingException( invalidSourceError( parameters, QStringLiteral( "INPUT" ) ) );
6666

6767
std::unique_ptr< QgsFeatureSource > sourceB( parameterAsSource( parameters, QStringLiteral( "OVERLAY" ), context ) );
68-
// sourceB is optional so we do not throw an error if it is not a valid source
68+
if ( parameters.value( QStringLiteral( "OVERLAY" ) ).isValid() && !sourceB )
69+
throw QgsProcessingException( invalidSourceError( parameters, QStringLiteral( "OVERLAY" ) ) );
6970

7071
QgsWkbTypes::Type geomType = QgsWkbTypes::multiType( sourceA->wkbType() );
7172

0 commit comments

Comments
 (0)