Skip to content

Commit

Permalink
bug: check for empty string in parameter values
Browse files Browse the repository at this point in the history
  • Loading branch information
Rashad Kanavath authored and nyalldawson committed Mar 20, 2019
1 parent d3a1c65 commit f1cc8aa
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions python/plugins/processing/algs/otb/OtbAlgorithm.py
Expand Up @@ -55,6 +55,7 @@
from processing.algs.otb.OtbChoiceWidget import OtbParameterChoice
from processing.algs.otb.OtbUtils import OtbUtils


class OtbAlgorithm(QgsProcessingAlgorithm):

def __init__(self, group, name, descriptionfile, display_name='', groupId=''):
Expand Down Expand Up @@ -204,7 +205,7 @@ def processAlgorithm(self, parameters, context, feedback):
outputPixelType = None
for k, v in parameters.items():
# if value is None for a parameter we don't have any businees with this key
if v is None:
if not v or v is None:
continue
# for 'outputpixeltype' parameter we find the pixeltype string from self.pixelTypes
if k == 'outputpixeltype':
Expand Down Expand Up @@ -257,11 +258,12 @@ def processAlgorithm(self, parameters, context, feedback):

for out in self.destinationParameterDefinitions():
filePath = self.parameterAsOutputLayer(parameters, out.name(), context)
output_files[out.name()] = filePath
if outputPixelType is not None:
command += ' -{} "{}" "{}"'.format(out.name(), filePath, outputPixelType)
else:
command += ' -{} "{}"'.format(out.name(), filePath)
if filePath:
output_files[out.name()] = filePath
if outputPixelType is not None:
command += ' -{} "{}" "{}"'.format(out.name(), filePath, outputPixelType)
else:
command += ' -{} "{}"'.format(out.name(), filePath)

OtbUtils.executeOtb(command, feedback)

Expand Down

0 comments on commit f1cc8aa

Please sign in to comment.