Skip to content
Permalink
Browse files

Merge pull request #2534 from mhugo/fix_nullp

Fix a crash when trying to removeMapLayer a null pointer
  • Loading branch information
elpaso committed Dec 4, 2015
2 parents ab3542a + 984d1f2 commit 782949739993fba6f9706da57f5b574a068edfa2
Showing with 7 additions and 3 deletions.
  1. +5 −1 src/core/qgsmaplayerregistry.cpp
  2. +2 −2 src/core/qgsmaplayerregistry.h
@@ -131,14 +131,18 @@ void QgsMapLayerRegistry::removeMapLayers( const QList<QgsMapLayer*>& layers )

Q_FOREACH ( QgsMapLayer* layer, layers )
{
layerIds << layer->id();
if ( layer )
layerIds << layer->id();
}

emit layersWillBeRemoved( layerIds );
emit layersWillBeRemoved( layers );

Q_FOREACH ( QgsMapLayer* lyr, layers )
{
if ( !lyr )
continue;

QString myId( lyr->id() );
if ( mOwnedLayers.contains( lyr ) )
{
@@ -129,7 +129,7 @@ class CORE_EXPORT QgsMapLayerRegistry : public QObject
* The layers being removed are deleted as well as the registry
* table entries.
*
* @param layers The layers to remove
* @param layers The layers to remove. Null pointers are ignored
*
* @note As a side-effect QgsProject is made dirty.
*/
@@ -159,7 +159,7 @@ class CORE_EXPORT QgsMapLayerRegistry : public QObject
* The layer being removed is deleted as well as the registry
* table entry.
*
* @param layer The layer to remove
* @param layer The layer to remove. Nothing happens if the pointer is null
*
* @note As a side-effect QgsProject is made dirty.
*/

0 comments on commit 7829497

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