make QgsMapLayerRegistry::addLayer() a bit more robust

git-svn-id: http://svn.osgeo.org/qgis/trunk@11961 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
jef 2009-11-07 16:51:31 +00:00
parent bd9186bdbf
commit 04e023c91b

View File

@ -66,7 +66,7 @@ QgsMapLayer * QgsMapLayerRegistry::mapLayer( QString theLayerId )
QgsMapLayer * QgsMapLayer *
QgsMapLayerRegistry::addMapLayer( QgsMapLayer * theMapLayer, bool theEmitSignal ) QgsMapLayerRegistry::addMapLayer( QgsMapLayer * theMapLayer, bool theEmitSignal )
{ {
if ( !theMapLayer->isValid() ) if ( !theMapLayer || !theMapLayer->isValid() )
{ {
QgsDebugMsg( "cannot add invalid layers" ); QgsDebugMsg( "cannot add invalid layers" );
return 0; return 0;