Skip to content
Permalink
Browse files

fix crash with missing layer of a relation (#38574)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
qgis-bot and github-actions committed Sep 3, 2020
1 parent defa16c commit 7fcb12c4aa1d5d72cd2ca6841e94aa6a800c9735
Showing with 18 additions and 8 deletions.
  1. +14 −7 src/gui/attributetable/qgsfeaturelistview.cpp
  2. +4 −1 src/gui/qgsrelationeditorwidget.cpp
@@ -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" ) );
}
}

@@ -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;
@@ -922,7 +925,7 @@ void QgsRelationEditorWidget::updateUi()

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

0 comments on commit 7fcb12c

Please sign in to comment.
You can’t perform that action at this time.