Skip to content

Commit

Permalink
Merge pull request #46513 from nirvn/crash_fix
Browse files Browse the repository at this point in the history
Follow up PR #46505: fix crasher
  • Loading branch information
m-kuhn committed Dec 16, 2021
2 parents 41801d9 + 3d3fbab commit dd83635
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/gui/qgsexpressiontreeview.cpp
Expand Up @@ -423,8 +423,11 @@ void QgsExpressionTreeView::loadLayers()

void QgsExpressionTreeView::loadLayerFields( QgsVectorLayer *layer, QgsExpressionItem *parentItem )
{
const QgsFields fields { layer->fields() };
for ( int fieldIdx = 0; fieldIdx < layer->fields().count(); ++fieldIdx )
if ( !layer )
return;

const QgsFields fields = layer->fields();
for ( int fieldIdx = 0; fieldIdx < fields.count(); ++fieldIdx )
{
const QgsField field = fields.at( fieldIdx );
QIcon icon = fields.iconForField( fieldIdx );
Expand Down

0 comments on commit dd83635

Please sign in to comment.