File tree 2 files changed +7
-3
lines changed
2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -131,14 +131,18 @@ void QgsMapLayerRegistry::removeMapLayers( const QList<QgsMapLayer*>& layers )
131
131
132
132
Q_FOREACH ( QgsMapLayer* layer, layers )
133
133
{
134
- layerIds << layer->id ();
134
+ if ( layer )
135
+ layerIds << layer->id ();
135
136
}
136
137
137
138
emit layersWillBeRemoved ( layerIds );
138
139
emit layersWillBeRemoved ( layers );
139
140
140
141
Q_FOREACH ( QgsMapLayer* lyr, layers )
141
142
{
143
+ if ( !lyr )
144
+ continue ;
145
+
142
146
QString myId ( lyr->id () );
143
147
if ( mOwnedLayers .contains ( lyr ) )
144
148
{
Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ class CORE_EXPORT QgsMapLayerRegistry : public QObject
129
129
* The layers being removed are deleted as well as the registry
130
130
* table entries.
131
131
*
132
- * @param layers The layers to remove
132
+ * @param layers The layers to remove. Null pointers are ignored
133
133
*
134
134
* @note As a side-effect QgsProject is made dirty.
135
135
*/
@@ -159,7 +159,7 @@ class CORE_EXPORT QgsMapLayerRegistry : public QObject
159
159
* The layer being removed is deleted as well as the registry
160
160
* table entry.
161
161
*
162
- * @param layer The layer to remove
162
+ * @param layer The layer to remove. Nothing happens if the pointer is null
163
163
*
164
164
* @note As a side-effect QgsProject is made dirty.
165
165
*/
You can’t perform that action at this time.
0 commit comments