Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c8896f3

Browse files
nirvngithub-actions[bot]
authored andcommittedOct 25, 2023
[processing] Fix crash when adding a mesh dataset group input
1 parent 5a25e2f commit c8896f3

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed
 

‎src/gui/processing/qgsprocessingmeshdatasetwidget.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -782,14 +782,17 @@ QgsProcessingMeshDatasetGroupsParameterDefinitionWidget::QgsProcessingMeshDatase
782782

783783
const QgsProcessingParameterMeshDatasetGroups *datasetGroupDef =
784784
static_cast< const QgsProcessingParameterMeshDatasetGroups *>( definition );
785-
int currentIndex = mParentLayerComboBox->findData( datasetGroupDef->meshLayerParameterName() );
786-
if ( currentIndex != -1 )
787-
mParentLayerComboBox->setCurrentIndex( currentIndex );
788-
else if ( !datasetGroupDef->meshLayerParameterName().isEmpty() )
789-
{
790-
// if no layer parameter candidates found, we just add the existing one as a placeholder
791-
mParentLayerComboBox->addItem( datasetGroupDef->meshLayerParameterName(), datasetGroupDef->meshLayerParameterName() );
792-
mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
785+
if ( datasetGroupDef )
786+
{
787+
int currentIndex = mParentLayerComboBox->findData( datasetGroupDef->meshLayerParameterName() );
788+
if ( currentIndex != -1 )
789+
mParentLayerComboBox->setCurrentIndex( currentIndex );
790+
else if ( !datasetGroupDef->meshLayerParameterName().isEmpty() )
791+
{
792+
// if no layer parameter candidates found, we just add the existing one as a placeholder
793+
mParentLayerComboBox->addItem( datasetGroupDef->meshLayerParameterName(), datasetGroupDef->meshLayerParameterName() );
794+
mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
795+
}
793796
}
794797

795798
setLayout( vlayout );

0 commit comments

Comments
 (0)
Please sign in to comment.