Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[processing] Don't show invalid layer warning if a layer was not even…
… set
  • Loading branch information
nyalldawson committed Jan 15, 2020
1 parent ff96140 commit 15a6363
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/gui/processing/qgsprocessingwidgetwrapperimpl.cpp
Expand Up @@ -3323,15 +3323,16 @@ void QgsProcessingFieldWidgetWrapper::setParentLayerWrapperValue( const QgsAbstr
context = tmpContext.get();
}

QgsVectorLayer *layer = QgsProcessingParameters::parameterAsVectorLayer( parentWrapper->parameterDefinition(), parentWrapper->parameterValue(), *context );
const QVariant value = parentWrapper->parameterValue();
QgsVectorLayer *layer = QgsProcessingParameters::parameterAsVectorLayer( parentWrapper->parameterDefinition(), value, *context );
if ( !layer || !layer->isValid() )
{
if ( mComboBox )
mComboBox->setLayer( nullptr );
else if ( mPanel )
mPanel->setFields( QgsFields() );

if ( widgetContext().messageBar() )
if ( value.isValid() && widgetContext().messageBar() )
{
widgetContext().messageBar()->clearWidgets();
widgetContext().messageBar()->pushMessage( QString(), QObject::tr( "Could not load selected layer/table. Dependent field could not be populated" ),
Expand Down

0 comments on commit 15a6363

Please sign in to comment.