Skip to content
Permalink
Browse files

[mesh] Fix a crash when loading a file with no dataset groups

  • Loading branch information
wonder-sk committed Jul 23, 2018
1 parent cc1511c commit 881ba9d2b9b7bb8f3a7b2e8cf4306f5062cc4025
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/app/mesh/qgsmeshrendereractivedatasetwidget.cpp
@@ -54,7 +54,8 @@ void QgsMeshRendererActiveDatasetWidget::setSliderRange()
{
int datasetCount = 1;
if ( mMeshLayer &&
mMeshLayer->dataProvider() )
mMeshLayer->dataProvider() &&
mDatasetGroupTreeView->activeGroup() != -1 )
datasetCount = mMeshLayer->dataProvider()->datasetCount( mDatasetGroupTreeView->activeGroup() );

mDatasetSlider->setMinimum( 0 );
@@ -84,6 +85,7 @@ void QgsMeshRendererActiveDatasetWidget::onActiveDatasetChanged( int value )

if ( mMeshLayer &&
mMeshLayer->dataProvider() &&
datasetIndex.isValid() &&
mMeshLayer->dataProvider()->datasetCount( groupIndex ) > value )
{
const QgsMeshDatasetGroupMetadata meta = mMeshLayer->dataProvider()->datasetGroupMetadata( datasetIndex );
@@ -149,6 +151,7 @@ QgsMeshDatasetIndex QgsMeshRendererActiveDatasetWidget::datasetIndex() const

if ( mMeshLayer &&
mMeshLayer->dataProvider() &&
groupIndex != -1 &&
mMeshLayer->dataProvider()->datasetCount( groupIndex ) > value
)
return QgsMeshDatasetIndex( groupIndex, value );

0 comments on commit 881ba9d

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