Skip to content

Commit

Permalink
Fix crash when resetting a project-less snapping config
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Nov 15, 2019
1 parent f53e137 commit 38204a6
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/core/qgssnappingconfig.cpp
Expand Up @@ -147,14 +147,17 @@ void QgsSnappingConfig::reset()
mIntersectionSnapping = false;

// set advanced config
mIndividualLayerSettings = QHash<QgsVectorLayer *, IndividualLayerSettings>();
const auto constMapLayers = mProject->mapLayers();
for ( QgsMapLayer *ml : constMapLayers )
if ( mProject )
{
QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( ml );
if ( vl )
mIndividualLayerSettings = QHash<QgsVectorLayer *, IndividualLayerSettings>();
const auto constMapLayers = mProject->mapLayers();
for ( QgsMapLayer *ml : constMapLayers )
{
mIndividualLayerSettings.insert( vl, IndividualLayerSettings( enabled, type, tolerance, units ) );
QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( ml );
if ( vl )
{
mIndividualLayerSettings.insert( vl, IndividualLayerSettings( enabled, type, tolerance, units ) );
}
}
}
}
Expand Down

0 comments on commit 38204a6

Please sign in to comment.