Skip to content

Commit

Permalink
Fix crash in metadata widget when remove is clicked and no items exist
Browse files Browse the repository at this point in the history
Fixes #20943
  • Loading branch information
nyalldawson committed Jan 14, 2019
1 parent 9b75a82 commit 3bc06e2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/gui/qgsmetadatawidget.cpp
Expand Up @@ -295,6 +295,8 @@ void QgsMetadataWidget::addConstraint()
void QgsMetadataWidget::removeSelectedConstraint()
{
const QModelIndexList selectedRows = tabConstraints->selectionModel()->selectedRows();
if ( selectedRows.empty() )
return;
mConstraintsModel->removeRow( selectedRows[0].row() );
}

Expand Down Expand Up @@ -394,6 +396,9 @@ void QgsMetadataWidget::addLink()
void QgsMetadataWidget::removeSelectedLink()
{
const QModelIndexList selectedRows = tabLinks->selectionModel()->selectedRows();
if ( selectedRows.empty() )
return;

mLinksModel->removeRow( selectedRows[0].row() );
}

Expand Down

0 comments on commit 3bc06e2

Please sign in to comment.