From 68ee73dd76adffb11721679c7bee990ed44728bc Mon Sep 17 00:00:00 2001 From: Jacky Volpes Date: Thu, 28 Nov 2024 18:07:32 +0100 Subject: [PATCH] fix(elevationprofilecanvas): avoid crash on segfault If no profile curve is set and regenerateResultsForLayer is run (triggered by adding a feature in a layer for instance), then QGIS crashes. --- src/gui/elevation/qgselevationprofilecanvas.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/elevation/qgselevationprofilecanvas.cpp b/src/gui/elevation/qgselevationprofilecanvas.cpp index 42b8726eab71..177cea911355 100644 --- a/src/gui/elevation/qgselevationprofilecanvas.cpp +++ b/src/gui/elevation/qgselevationprofilecanvas.cpp @@ -982,6 +982,9 @@ void QgsElevationProfileCanvas::onLayerProfileRendererPropertyChanged() void QgsElevationProfileCanvas::regenerateResultsForLayer() { + if ( !mCurrentJob ) + return; + if ( QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( sender() ) ) { if ( QgsAbstractProfileSource *source = dynamic_cast< QgsAbstractProfileSource * >( layer ) )