Skip to content
Permalink
Browse files

bug: check for empty string in parameter values

  • Loading branch information
rkanavath authored and nyalldawson committed Mar 18, 2019
1 parent d3a1c65 commit f1cc8aa108bd640168dadde4cd370d1568698893
Showing with 8 additions and 6 deletions.
  1. +8 −6 python/plugins/processing/algs/otb/OtbAlgorithm.py
@@ -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=''):
@@ -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':
@@ -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)

0 comments on commit f1cc8aa

Please sign in to comment.
You can’t perform that action at this time.