Fix Python exception in Random Points in Polygon alg

Fixes #18103
This commit is contained in:
Nyall Dawson 2018-02-15 07:23:50 +10:00
parent 792c19ba70
commit 8154a85f29

View File

@ -113,11 +113,11 @@ class RandomPointsPolygons(QgisAlgorithm):
expression = QgsExpression(self.parameterAsString(parameters, self.EXPRESSION, context))
if expression.hasParserError():
raise ProcessingException(expression.parserErrorString())
raise QgsProcessingException(expression.parserErrorString())
expressionContext = self.createExpressionContext(parameters, context)
if not expression.prepare(expressionContext):
raise ProcessingException(
raise QgsProcessingException(
self.tr('Evaluation error: {0}').format(expression.evalErrorString()))
fields = QgsFields()