Skip to content
Permalink
Browse files

[bugfix] Fix crash in virtual layers dlg when adding

Fixes #17724 Crash on clicking ADD in Virtual Layer
dialogue without defining a layer

A proper implementation should handle the Add button
state when a virtual layer definition is available.
  • Loading branch information
elpaso committed Dec 21, 2017
1 parent 9fe8729 commit 385d0ef94b501e6d30da7fe0de6913c78451ad48
Showing with 11 additions and 6 deletions.
  1. +11 −6 src/providers/virtual/qgsvirtuallayersourceselect.cpp
@@ -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 )
{

0 comments on commit 385d0ef

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