Skip to content

Commit

Permalink
Fix optional None input parameters handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Médéric RIBREUX committed Dec 26, 2017
1 parent 5321ee5 commit 433d376
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion python/plugins/processing/algs/grass7/Grass7Algorithm.py
Expand Up @@ -409,8 +409,12 @@ def processInputs(self, parameters, context):
paramName = param.name()
if not paramName in parameters:
continue
if isinstance(parameters[paramName], str) and len(parameters[paramName]) == 0:
# Handle Null parameter
if parameters[paramName] is None:
continue
elif isinstance(parameters[paramName], str) and len(parameters[paramName]) == 0:
continue

# Raster inputs needs to be imported into temp GRASS DB
if isinstance(param, QgsProcessingParameterRasterLayer):
if paramName not in self.exportedLayers:
Expand Down Expand Up @@ -622,6 +626,7 @@ def loadRasterLayerFromParameter(self, name, parameters, context, external=True,
:param band: imports only specified band. None for all bands.
"""
layer = self.parameterAsRasterLayer(parameters, name, context)
QgsMessageLog.logMessage('raster: {0}'.format(name), 'DEBUG', QgsMessageLog.INFO)
self.loadRasterLayer(name, layer, external, band)

def loadRasterLayer(self, name, layer, external=True, band=1):
Expand Down

0 comments on commit 433d376

Please sign in to comment.