Skip to content

Commit f03baa8

Browse files
committedApr 9, 2018
[processing][grass] Don't try to create skipped optional outputs
1 parent ee185cc commit f03baa8

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed
 

‎python/plugins/processing/algs/grass7/Grass7Algorithm.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,10 @@ def processOutputs(self, parameters, context, feedback):
637637

638638
for out in self.destinationParameterDefinitions():
639639
outName = out.name()
640+
if not outName in parameters:
641+
# skipped output
642+
continue
643+
640644
if isinstance(out, QgsProcessingParameterRasterDestination):
641645
self.exportRasterLayerFromParameter(outName, parameters, context)
642646
elif isinstance(out, QgsProcessingParameterVectorDestination):
@@ -688,8 +692,11 @@ def exportRasterLayerFromParameter(self, name, parameters, context, colorTable=T
688692
:param context: Algorithm context.
689693
:param colorTable: preserve color Table.
690694
"""
691-
fileName = os.path.normpath(
692-
self.parameterAsOutputLayer(parameters, name, context))
695+
fileName = self.parameterAsOutputLayer(parameters, name, context)
696+
if not fileName:
697+
return
698+
699+
fileName = os.path.normpath(fileName)
693700
grassName = '{}{}'.format(name, self.uniqueSuffix)
694701
outFormat = Grass7Utils.getRasterFormatFromFilename(fileName)
695702
createOpt = self.parameterAsString(parameters, self.GRASS_RASTER_FORMAT_OPT, context)

0 commit comments

Comments
 (0)
Please sign in to comment.