Tweak processing algorithm scope -- parameters should be available even if algorithm is unset

This commit is contained in:
Nyall Dawson 2018-09-21 10:02:09 +10:00
parent 2d3b8c8ee3
commit 8e49e94d92

View File

@ -1297,14 +1297,14 @@ QgsExpressionContextScope *QgsExpressionContextUtils::processingAlgorithmScope(
Q_UNUSED( context );
std::unique_ptr< QgsExpressionContextScope > scope( new QgsExpressionContextScope( QObject::tr( "Algorithm" ) ) );
scope->addFunction( QStringLiteral( "parameter" ), new GetProcessingParameterValue( parameters ) );
if ( !algorithm )
return scope.release();
//add standard algorithm variables
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "algorithm_id" ), algorithm->id(), true ) );
scope->addFunction( QStringLiteral( "parameter" ), new GetProcessingParameterValue( parameters ) );
return scope.release();
}