Skip to content

Commit 4ded76f

Browse files
committed
Merge pull request #1457 from rouault/fix_crash_attr_table_no_attr_col
Fix crash when opening entity form from layer without attribute
2 parents 60d93b3 + ec82076 commit 4ded76f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/gui/attributetable/qgsfeaturelistview.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,14 @@ void QgsFeatureListView::editSelectionChanged( QItemSelection deselected, QItemS
144144
QItemSelection currentSelection = mCurrentEditSelectionModel->selection();
145145
if ( currentSelection.size() == 1 )
146146
{
147-
QgsFeature feat;
148-
mModel->featureByIndex( mModel->mapFromMaster( currentSelection.indexes().first() ), feat );
147+
QModelIndexList indexList = currentSelection.indexes();
148+
if ( !indexList.isEmpty() )
149+
{
150+
QgsFeature feat;
151+
mModel->featureByIndex( mModel->mapFromMaster( indexList.first() ), feat );
149152

150-
emit currentEditSelectionChanged( feat );
153+
emit currentEditSelectionChanged( feat );
154+
}
151155
}
152156
}
153157

0 commit comments

Comments
 (0)