From ee185cce4da32ac19e4be76bd00c7b113eb3b5bd Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 9 Apr 2018 14:32:18 +1000 Subject: [PATCH] [processing] Fix python runAlgorithm when algorithm has missing optional outputs --- python/plugins/processing/core/Processing.py | 3 +++ .../testdata/custom/circular_strings.gpkg | Bin 131072 -> 131072 bytes 2 files changed, 3 insertions(+) diff --git a/python/plugins/processing/core/Processing.py b/python/plugins/processing/core/Processing.py index 06289b325c8..db17c63e898 100644 --- a/python/plugins/processing/core/Processing.py +++ b/python/plugins/processing/core/Processing.py @@ -162,6 +162,9 @@ class Processing(object): else: # auto convert layer references in results to map layers for out in alg.outputDefinitions(): + if out.name() not in results: + continue + if isinstance(out, (QgsProcessingOutputVectorLayer, QgsProcessingOutputRasterLayer, QgsProcessingOutputMapLayer)): result = results[out.name()] if not isinstance(result, QgsMapLayer): diff --git a/python/plugins/processing/tests/testdata/custom/circular_strings.gpkg b/python/plugins/processing/tests/testdata/custom/circular_strings.gpkg index 3f82c62ed55b72223706a633ce3382f91ec9d517..6c42ec2c58d3c08169cfca8cd1e6b89e8ff51768 100644 GIT binary patch delta 22 dcmZo@;Am*zm>|s|t)J5k1&(Y7&RYXakf{{T>%2fhFR