Skip to content

Commit

Permalink
Follow up PR #46505: fix crasher
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Dec 16, 2021
1 parent 132294b commit 3d3fbab
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 3d3fbab

Please sign in to comment.