Skip to content

Commit f1cc8aa

Browse files
Rashad Kanavathnyalldawson
authored andcommitted
bug: check for empty string in parameter values
1 parent d3a1c65 commit f1cc8aa

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

python/plugins/processing/algs/otb/OtbAlgorithm.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
from processing.algs.otb.OtbChoiceWidget import OtbParameterChoice
5656
from processing.algs.otb.OtbUtils import OtbUtils
5757

58+
5859
class OtbAlgorithm(QgsProcessingAlgorithm):
5960

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

258259
for out in self.destinationParameterDefinitions():
259260
filePath = self.parameterAsOutputLayer(parameters, out.name(), context)
260-
output_files[out.name()] = filePath
261-
if outputPixelType is not None:
262-
command += ' -{} "{}" "{}"'.format(out.name(), filePath, outputPixelType)
263-
else:
264-
command += ' -{} "{}"'.format(out.name(), filePath)
261+
if filePath:
262+
output_files[out.name()] = filePath
263+
if outputPixelType is not None:
264+
command += ' -{} "{}" "{}"'.format(out.name(), filePath, outputPixelType)
265+
else:
266+
command += ' -{} "{}"'.format(out.name(), filePath)
265267

266268
OtbUtils.executeOtb(command, feedback)
267269

0 commit comments

Comments
 (0)