Skip to content

Commit 20ec29a

Browse files
nyalldawson3nids
authored andcommittedMar 28, 2019
[processing] Refine check for usable layers (#9640)
- allow WMS layers and other non-GDAL raster layers. This will work fine for native algorithms, likely not work for other providers. They will need to be adapted to throw errors when incompatible raster layer providers are used - invalid layers are not permitted (e.g. those with missing data sources)
1 parent f5a3485 commit 20ec29a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎src/core/processing/qgsprocessingutils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,12 +368,12 @@ bool QgsProcessingUtils::canUseLayer( const QgsMeshLayer *layer )
368368
bool QgsProcessingUtils::canUseLayer( const QgsRasterLayer *layer )
369369
{
370370
// only gdal file-based layers
371-
return layer && layer->providerType() == QStringLiteral( "gdal" );
371+
return layer && layer->isValid();
372372
}
373373

374374
bool QgsProcessingUtils::canUseLayer( const QgsVectorLayer *layer, const QList<int> &sourceTypes )
375375
{
376-
return layer &&
376+
return layer && layer->isValid() &&
377377
( sourceTypes.isEmpty()
378378
|| ( sourceTypes.contains( QgsProcessing::TypeVectorPoint ) && layer->geometryType() == QgsWkbTypes::PointGeometry )
379379
|| ( sourceTypes.contains( QgsProcessing::TypeVectorLine ) && layer->geometryType() == QgsWkbTypes::LineGeometry )

0 commit comments

Comments
 (0)
Please sign in to comment.