Skip to content

Commit

Permalink
[processing][grass] Don't try to create skipped optional outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Apr 9, 2018
1 parent c90e783 commit 861c0b2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions python/plugins/processing/algs/grass7/Grass7Algorithm.py
Expand Up @@ -637,6 +637,10 @@ def processOutputs(self, parameters, context, feedback):

for out in self.destinationParameterDefinitions():
outName = out.name()
if not outName in parameters:
# skipped output
continue

if isinstance(out, QgsProcessingParameterRasterDestination):
self.exportRasterLayerFromParameter(outName, parameters, context)
elif isinstance(out, QgsProcessingParameterVectorDestination):
Expand Down Expand Up @@ -688,8 +692,11 @@ def exportRasterLayerFromParameter(self, name, parameters, context, colorTable=T
:param context: Algorithm context.
:param colorTable: preserve color Table.
"""
fileName = os.path.normpath(
self.parameterAsOutputLayer(parameters, name, context))
fileName = self.parameterAsOutputLayer(parameters, name, context)
if not fileName:
return

fileName = os.path.normpath(fileName)
grassName = '{}{}'.format(name, self.uniqueSuffix)
outFormat = Grass7Utils.getRasterFormatFromFilename(fileName)
createOpt = self.parameterAsString(parameters, self.GRASS_RASTER_FORMAT_OPT, context)
Expand Down

0 comments on commit 861c0b2

Please sign in to comment.