Skip to content

Commit

Permalink
Merge pull request #5936 from elpaso/bugfix-17724-virtuallayer-crash
Browse files Browse the repository at this point in the history
[bugfix] Fix crash in virtual layers dlg when adding
  • Loading branch information
elpaso committed Dec 22, 2017
2 parents 224dcd0 + 385d0ef commit 02152ac
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/providers/virtual/qgsvirtuallayersourceselect.cpp
Expand Up @@ -374,13 +374,18 @@ void QgsVirtualLayerSourceSelect::addButtonClicked()
}
}
}
if ( replace )
{
emit replaceVectorLayer( id, def.toString(), layerName, QStringLiteral( "virtual" ) );
}
else
// This check is to prevent a crash, a proper implementation should handle
// the Add button state when a virtual layer definition is available
if ( ! def.toString().isEmpty() )
{
emit addVectorLayer( def.toString(), layerName );
if ( replace )
{
emit replaceVectorLayer( id, def.toString(), layerName, QStringLiteral( "virtual" ) );
}
else
{
emit addVectorLayer( def.toString(), layerName );
}
}
if ( widgetMode() == QgsProviderRegistry::WidgetMode::None )
{
Expand Down

0 comments on commit 02152ac

Please sign in to comment.