From 60ad7d43b3fb084f7c436f9f345fcecd4f7ec0e0 Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Mon, 22 Feb 2021 15:04:10 +0100 Subject: [PATCH] Fix calling in place with empty iterator ``` File "/home/mkuhn/.local/share/QGIS/QGIS3/profiles/default/python/plugins/autocurve/plugin.py", line 127, in curvify AlgorithmExecutor.execute_in_place(alg, {}) File "/usr/share/qgis/python/plugins/processing/gui/AlgorithmExecutor.py", line 305, in execute_in_place ok, results = execute_in_place_run(alg, parameters, context=context, feedback=feedback) File "/usr/share/qgis/python/plugins/processing/gui/AlgorithmExecutor.py", line 214, in execute_in_place_run results, ok = {'__count': current + 1}, True UnboundLocalError: local variable 'current' referenced before assignment ``` --- python/plugins/processing/gui/AlgorithmExecutor.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/plugins/processing/gui/AlgorithmExecutor.py b/python/plugins/processing/gui/AlgorithmExecutor.py index 7a3e5a1c80e..8cea6fa590c 100644 --- a/python/plugins/processing/gui/AlgorithmExecutor.py +++ b/python/plugins/processing/gui/AlgorithmExecutor.py @@ -179,6 +179,7 @@ def execute_in_place_run(alg, parameters, context=None, feedback=None, raise_exc iterator_req.setInvalidGeometryCheck(context.invalidGeometryCheck()) feature_iterator = active_layer.getFeatures(iterator_req) step = 100 / len(active_layer.selectedFeatureIds()) if active_layer.selectedFeatureIds() else 1 + current = 0 for current, f in enumerate(feature_iterator): if feedback.isCanceled(): break