Skip to content


Browse files Browse the repository at this point in the history
[processing] Correctly handle when no feedback object is passed
  • Loading branch information
nyalldawson committed Jan 11, 2017
1 parent ede452b commit 86e1138
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
5 changes: 4 additions & 1 deletion python/plugins/processing/algs/qgis/
Expand Up @@ -31,7 +31,7 @@
import xml.sax.saxutils

from osgeo import ogr

from qgis.core import QgsProcessingFeedback
from import dataobjects
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
Expand Down Expand Up @@ -90,6 +90,9 @@ def mergeDataSources2Vrt(self, dataSources, outFile, union=False, relative=False
@param schema: Schema flag
@return: vrt in string format
if feedback is None:
feedback = QgsProcessingFeedback()

vrt = '<OGRVRTDataSource>'
if union:
vrt += '<OGRVRTUnionLayer name="UnionedLayer">'
Expand Down
6 changes: 5 additions & 1 deletion python/plugins/processing/core/
Expand Up @@ -193,7 +193,7 @@ def processBeforeAddingToModeler(self, alg, model):

# =========================================================

def execute(self, feedback=QgsProcessingFeedback(), model=None):
def execute(self, feedback=None, model=None):
"""The method to use to call a processing algorithm.
Although the body of the algorithm is in processAlgorithm(),
Expand All @@ -203,6 +203,10 @@ def execute(self, feedback=QgsProcessingFeedback(), model=None):
Raises a GeoAlgorithmExecutionException in case anything goes

if feedback is None:
feedback = QgsProcessingFeedback()

self.model = model
Expand Down
6 changes: 5 additions & 1 deletion python/plugins/processing/gui/
Expand Up @@ -48,8 +48,12 @@ def runalg(alg, feedback=None):
Return true if everything went OK, false if the algorithm
could not be completed.

if feedback is None:
feedback = QgsProcessingFeedback()

alg.execute(feedback or QgsProcessingFeedback())
return True
except GeoAlgorithmExecutionException as e:
ProcessingLog.addToLog(sys.exc_info()[0], ProcessingLog.LOG_ERROR)
Expand Down

0 comments on commit 86e1138

Please sign in to comment.