Skip to content

Commit

Permalink
[processing] Fix crash when algorithms fail to prepare
Browse files Browse the repository at this point in the history
Refs #15640
  • Loading branch information
nyalldawson committed Feb 25, 2018
1 parent 574a654 commit 2900ace
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion python/plugins/processing/algs/qgis/FieldsMapper.py
Expand Up @@ -138,10 +138,11 @@ def prepareAlgorithm(self, parameters, context, feedback):
expression.setDistanceUnits(context.project().distanceUnits())
expression.setAreaUnits(context.project().areaUnits())
if expression.hasParserError():
raise QgsProcessingException(
feedback.reportError(
self.tr(u'Parser error in expression "{}": {}')
.format(expression.expression(),
expression.parserErrorString()))
return False
self.expressions.append(expression)
return True

Expand Down
4 changes: 4 additions & 0 deletions src/core/processing/qgsprocessingalgrunnertask.cpp
Expand Up @@ -41,10 +41,14 @@ QgsProcessingAlgRunnerTask::QgsProcessingAlgRunnerTask( const QgsProcessingAlgor
void QgsProcessingAlgRunnerTask::cancel()
{
mFeedback->cancel();
QgsTask::cancel();
}

bool QgsProcessingAlgRunnerTask::run()
{
if ( isCanceled() )
return false;

connect( mFeedback, &QgsFeedback::progressChanged, this, &QgsProcessingAlgRunnerTask::setProgress );
bool ok = false;
try
Expand Down

0 comments on commit 2900ace

Please sign in to comment.