Skip to content

Commit

Permalink
Fix crash when loading style in layer properties
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Jun 29, 2016
1 parent 118bbf7 commit 58dbe56
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/app/qgslayerstylingwidget.cpp
Expand Up @@ -282,11 +282,12 @@ void QgsLayerStylingWidget::updateCurrentWidgetLayer()
{
mBlockAutoApply = true;

QgsMapLayer* layer = mCurrentLayer;
if ( !mCurrentLayer )
return;

This comment has been minimized.

Copy link
@m-kuhn

m-kuhn Jun 29, 2016

Author Member

@NathanW2
does that look sane to you? (It's only this line that's important, the rest is pure cosmetics)


mUndoWidget->setUndoStack( layer->undoStackStyles() );
mUndoWidget->setUndoStack( mCurrentLayer->undoStackStyles() );

whileBlocking( mLayerCombo )->setLayer( layer );
whileBlocking( mLayerCombo )->setLayer( mCurrentLayer );

int row = mOptionsListWidget->currentIndex().row();

Expand Down Expand Up @@ -316,7 +317,7 @@ void QgsLayerStylingWidget::updateCurrentWidgetLayer()
// TODO Make all widgets use this method.
if ( mUserPages.contains( row ) )
{
QgsLayerStylingPanel* panel = mUserPages[row]->createPanel( layer, mMapCanvas, mWidgetStack );
QgsLayerStylingPanel* panel = mUserPages[row]->createPanel( mCurrentLayer, mMapCanvas, mWidgetStack );
if ( panel )
{
connect( panel, SIGNAL( widgetChanged( QgsPanelWidget* ) ), this, SLOT( autoApply() ) );
Expand All @@ -329,9 +330,9 @@ void QgsLayerStylingWidget::updateCurrentWidgetLayer()
{
mWidgetStack->addMainPanel( mUndoWidget );
}
else if ( layer->type() == QgsMapLayer::VectorLayer )
else if ( mCurrentLayer->type() == QgsMapLayer::VectorLayer )
{
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer*>( layer );
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer*>( mCurrentLayer );

switch ( row )
{
Expand Down Expand Up @@ -363,9 +364,9 @@ void QgsLayerStylingWidget::updateCurrentWidgetLayer()
break;
}
}
else if ( layer->type() == QgsMapLayer::RasterLayer )
else if ( mCurrentLayer->type() == QgsMapLayer::RasterLayer )
{
QgsRasterLayer *rlayer = qobject_cast<QgsRasterLayer*>( layer );
QgsRasterLayer *rlayer = qobject_cast<QgsRasterLayer*>( mCurrentLayer );

switch ( row )
{
Expand Down

0 comments on commit 58dbe56

Please sign in to comment.