Skip to content
Permalink
Browse files

add only valid layers, fixes #812

git-svn-id: http://svn.osgeo.org/qgis/trunk@7624 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Nov 20, 2007
1 parent 1213e34 commit 4dbc0bc5c7258cd5a7744bf0557729123faa4a2c
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/core/qgsmaplayerregistry.cpp
@@ -77,6 +77,11 @@ QgsMapLayer *
QgsMapLayerRegistry::addMapLayer( QgsMapLayer * theMapLayer, bool theEmitSignal )
{
QgsDebugMsg("QgsMapLayerRegistry::addMaplayer - '" + theMapLayer->name());
if( !theMapLayer->isValid() ) {
QgsDebugMsg("cannot add invalid layers");
return 0;
}

//check the layer is not already registered!
std::map<QString,QgsMapLayer*>::iterator myIterator = mMapLayers.find(theMapLayer->getLayerID());
//if myIterator returns mMapLayers.end() then it does not exist in registry and its safe to add it
@@ -92,7 +97,7 @@ QgsMapLayer *
else
{
QgsDebugMsg("addMaplayer - " + theMapLayer->name() + " already registered");
return 0x0;
return 0;
}
} // QgsMapLayerRegistry::addMapLayer

0 comments on commit 4dbc0bc

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