Skip to content

Commit

Permalink
Fix unreported crash when clicking edit button in vector tile rendere…
Browse files Browse the repository at this point in the history
…r/labeling settings and no row is selected
  • Loading branch information
github-actions[bot] authored and nyalldawson committed Sep 7, 2020
1 parent 93b4d20 commit 016e187
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/gui/vectortile/qgsvectortilebasiclabelingwidget.cpp
Expand Up @@ -348,6 +348,9 @@ void QgsVectorTileBasicLabelingWidget::editStyle()

void QgsVectorTileBasicLabelingWidget::editStyleAtIndex( const QModelIndex &index )
{
if ( index.row() < 0 || index.row() >= mLabeling->styles().count() )
return;

QgsVectorTileBasicLabelingStyle style = mLabeling->style( index.row() );

QgsPalLayerSettings labelSettings = style.labelSettings();
Expand Down Expand Up @@ -385,6 +388,9 @@ void QgsVectorTileBasicLabelingWidget::editStyleAtIndex( const QModelIndex &inde
void QgsVectorTileBasicLabelingWidget::updateLabelingFromWidget()
{
int index = viewStyles->selectionModel()->currentIndex().row();
if ( index < 0 )
return;

QgsVectorTileBasicLabelingStyle style = mLabeling->style( index );

QgsLabelingPanelWidget *widget = qobject_cast<QgsLabelingPanelWidget *>( sender() );
Expand Down
6 changes: 6 additions & 0 deletions src/gui/vectortile/qgsvectortilebasicrendererwidget.cpp
Expand Up @@ -361,6 +361,9 @@ void QgsVectorTileBasicRendererWidget::editStyle()

void QgsVectorTileBasicRendererWidget::editStyleAtIndex( const QModelIndex &index )
{
if ( index.row() < 0 || index.row() >= mRenderer->styles().count() )
return;

QgsVectorTileBasicRendererStyle style = mRenderer->style( index.row() );

if ( !style.symbol() )
Expand Down Expand Up @@ -402,6 +405,9 @@ void QgsVectorTileBasicRendererWidget::editStyleAtIndex( const QModelIndex &inde
void QgsVectorTileBasicRendererWidget::updateSymbolsFromWidget()
{
int index = viewStyles->selectionModel()->currentIndex().row();
if ( index < 0 )
return;

QgsVectorTileBasicRendererStyle style = mRenderer->style( index );

QgsSymbolSelectorWidget *dlg = qobject_cast<QgsSymbolSelectorWidget *>( sender() );
Expand Down

0 comments on commit 016e187

Please sign in to comment.