Skip to content
Permalink
Browse files

[Backport release-3_10] fix crash with missing layer of a relation (#…

…38573)

* fix crash with missing layer of a  relation
  • Loading branch information
qgis-bot committed Sep 3, 2020
1 parent 6aec4e6 commit bca97e56169666ab93fb347f046bcce8d0497746
Showing with 16 additions and 9 deletions.
  1. +14 −7 src/gui/attributetable/qgsfeaturelistview.cpp
  2. +2 −2 src/gui/qgsrelationeditorwidget.cpp
@@ -230,18 +230,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" ) );
}
}

@@ -195,7 +195,7 @@ void QgsRelationEditorWidget::setRelationFeature( const QgsRelation &relation, c
// If it is already initialized, it has been set visible before and the currently shown feature is changing
// and the widget needs updating

if ( mVisible )
if ( mVisible && mRelation.isValid() )
{
QgsFeatureRequest myRequest = mRelation.getRelatedFeaturesRequest( mFeature );
mDualView->init( mRelation.referencingLayer(), mEditorContext.mapCanvas(), myRequest, mEditorContext );
@@ -732,7 +732,7 @@ void QgsRelationEditorWidget::updateUi()

mDualView->init( mNmRelation.referencedLayer(), mEditorContext.mapCanvas(), nmRequest, mEditorContext );
}
else
else if ( mRelation.referencingLayer() )
{
mDualView->init( mRelation.referencingLayer(), mEditorContext.mapCanvas(), myRequest, mEditorContext );
}

0 comments on commit bca97e5

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