Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix crash with missing layer of a relation (#38550)
  • Loading branch information
3nids committed Sep 3, 2020
1 parent a785991 commit f7a93d3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
21 changes: 14 additions & 7 deletions src/gui/attributetable/qgsfeaturelistview.cpp
Expand Up @@ -231,18 +231,25 @@ void QgsFeatureListView::repaintRequested()

void QgsFeatureListView::mouseMoveEvent( QMouseEvent *event )
{
QPoint pos = event->pos();
if ( mModel )
{
QPoint pos = event->pos();

QModelIndex index = indexAt( pos );
QModelIndex index = indexAt( pos );

if ( mEditSelectionDrag )
{
if ( index.isValid() )
setEditSelection( mModel->mapToMaster( index ), QItemSelectionModel::ClearAndSelect );
if ( mEditSelectionDrag )
{
if ( index.isValid() )
setEditSelection( mModel->mapToMaster( index ), QItemSelectionModel::ClearAndSelect );
}
else
{
selectRow( index, false );
}
}
else
{
selectRow( index, false );
QgsDebugMsg( QStringLiteral( "No model assigned to this view" ) );
}
}

Expand Down
5 changes: 4 additions & 1 deletion src/gui/qgsrelationeditorwidget.cpp
Expand Up @@ -47,6 +47,9 @@ QgsFilteredSelectionManager::QgsFilteredSelectionManager( QgsVectorLayer *layer,
: QgsVectorLayerSelectionManager( layer, parent )
, mRequest( request )
{
if ( ! layer )
return;

for ( auto fid : layer->selectedFeatureIds() )
if ( mRequest.acceptFeature( layer->getFeature( fid ) ) )
mSelectedFeatureIds << fid;
Expand Down Expand Up @@ -922,7 +925,7 @@ void QgsRelationEditorWidget::updateUi()

initDualView( mNmRelation.referencedLayer(), nmRequest );
}
else
else if ( mRelation.referencingLayer() )
{
initDualView( mRelation.referencingLayer(), myRequest );
}
Expand Down

0 comments on commit f7a93d3

Please sign in to comment.