Skip to content

Commit ec82076

Browse files
committedJun 16, 2014
Fix crash when opening entity form from layer without attribute
When right-clicking in the attribute table of a layer that has no attribute, no feature is selected. If selecting the 'Edit form' entry, we got a crash.
1 parent 5eddb74 commit ec82076

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed
 

‎src/gui/attributetable/qgsfeaturelistview.cpp

Lines changed: 7 additions & 3 deletions
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)
Please sign in to comment.