Skip to content

Commit

Permalink
[processing] Add warning when packaging a geopackage with no layers
Browse files Browse the repository at this point in the history
Fixes #31888
  • Loading branch information
nyalldawson committed Sep 20, 2019
1 parent cb481d4 commit f11e660
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/analysis/processing/qgsalgorithmpackage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,17 @@ QgsPackageAlgorithm *QgsPackageAlgorithm::createInstance() const
return new QgsPackageAlgorithm();
}

bool QgsPackageAlgorithm::prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback * )
bool QgsPackageAlgorithm::prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback )
{
const QList< QgsMapLayer * > layers = parameterAsLayerList( parameters, QStringLiteral( "LAYERS" ), context );
for ( QgsMapLayer *layer : layers )
{
mLayers.emplace_back( layer->clone() );
}

if ( mLayers.empty() )
feedback->reportError( QObject::tr( "No layers selected, geopackage will be empty" ), false );

return true;
}

Expand Down

0 comments on commit f11e660

Please sign in to comment.