Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[processing] Fix some crashes on invalid parameters
- Loading branch information
|
@@ -349,7 +349,12 @@ QgsExtractByLocationAlgorithm *QgsExtractByLocationAlgorithm::createInstance() c |
|
|
QVariantMap QgsExtractByLocationAlgorithm::processAlgorithm( const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) |
|
|
{ |
|
|
std::unique_ptr< QgsFeatureSource > input( parameterAsSource( parameters, QStringLiteral( "INPUT" ), context ) ); |
|
|
if ( !input ) |
|
|
throw QgsProcessingException( invalidSourceError( parameters, QStringLiteral( "INPUT" ) ) ); |
|
|
std::unique_ptr< QgsFeatureSource > intersectSource( parameterAsSource( parameters, QStringLiteral( "INTERSECT" ), context ) ); |
|
|
if ( !intersectSource ) |
|
|
throw QgsProcessingException( invalidSourceError( parameters, QStringLiteral( "INTERSECT" ) ) ); |
|
|
|
|
|
const QList< int > selectedPredicates = parameterAsEnums( parameters, QStringLiteral( "PREDICATE" ), context ); |
|
|
QString dest; |
|
|
std::unique_ptr< QgsFeatureSink > sink( parameterAsSink( parameters, QStringLiteral( "OUTPUT" ), context, dest, input->fields(), input->wkbType(), input->sourceCrs() ) ); |
|
|
|
@@ -71,6 +71,8 @@ QVariantMap QgsFileDownloaderAlgorithm::processAlgorithm( const QVariantMap &par |
|
|
{ |
|
|
mFeedback = feedback; |
|
|
QString url = parameterAsString( parameters, QStringLiteral( "URL" ), context ); |
|
|
if ( url.isEmpty() ) |
|
|
throw QgsProcessingException( tr( "No URL specified" ) ); |
|
|
QString outputFile = parameterAsFileOutput( parameters, QStringLiteral( "OUTPUT" ), context ); |
|
|
|
|
|
QEventLoop loop; |
|
|
|
@@ -69,6 +69,8 @@ QgsSaveSelectedFeatures *QgsSaveSelectedFeatures::createInstance() const |
|
|
QVariantMap QgsSaveSelectedFeatures::processAlgorithm( const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) |
|
|
{ |
|
|
QgsVectorLayer *selectLayer = parameterAsVectorLayer( parameters, QStringLiteral( "INPUT" ), context ); |
|
|
if ( !selectLayer ) |
|
|
throw QgsProcessingException( invalidSourceError( parameters, QStringLiteral( "INPUT" ) ) ); |
|
|
|
|
|
QString dest; |
|
|
std::unique_ptr< QgsFeatureSink > sink( parameterAsSink( parameters, QStringLiteral( "OUTPUT" ), context, dest, selectLayer->fields(), selectLayer->wkbType(), selectLayer->sourceCrs() ) ); |
|
|