Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix crash on layerless OGR data sources
git-svn-id: http://svn.osgeo.org/qgis/trunk@13817 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Jun 27, 2010
1 parent 70c4605 commit 0c1a961
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/app/qgisapp.cpp
Expand Up @@ -2627,7 +2627,7 @@ bool QgisApp::addVectorLayers( QStringList const & theLayerQStringList, const QS
delete layer;

}
else // there is 1 layer of data available
else if ( sublayers.count() > 0 ) // there is 1 layer of data available
{
//set friendly name for datasources with only one layer
QStringList sublayers = layer->dataProvider()->subLayers();
Expand All @@ -2637,6 +2637,12 @@ bool QgisApp::addVectorLayers( QStringList const & theLayerQStringList, const QS
// Register this layer with the layers registry
QgsMapLayerRegistry::instance()->addMapLayer( layer );
}
else
{
QString msg = tr( "%1 doesn't have any layers" ).arg( src );
QMessageBox::critical( this, tr( "Invalid Data Source" ), msg );
delete layer;
}
}
else
{
Expand Down

0 comments on commit 0c1a961

Please sign in to comment.