Skip to content

Commit b45f870

Browse files
author
jef
committed
mapserver: fix crash when layer cache is to small for project
git-svn-id: http://svn.osgeo.org/qgis/trunk@15161 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 721cc0f commit b45f870

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/mapserver/qgsprojectparser.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,13 @@ void QgsProjectParser::addLayers( QDomDocument &doc,
194194
else if ( currentChildElem.tagName() == "legendlayer" )
195195
{
196196
QString id = layerIdFromLegendLayer( currentChildElem );
197+
198+
if ( !layerMap.contains( id ) )
199+
{
200+
QgsMSDebugMsg( QString( "layer %1 not found in map - layer cache to small?" ).arg( id ) );
201+
continue;
202+
}
203+
197204
QgsMapLayer *currentLayer = layerMap[ id ];
198205
if ( !currentLayer )
199206
{
@@ -257,8 +264,7 @@ void QgsProjectParser::addLayers( QDomDocument &doc,
257264
continue;
258265
}
259266

260-
261-
#if QGSMSDEBUG
267+
#if 0
262268
QString buf;
263269
QTextStream s( &buf );
264270
layerElem.save( s, 0 );

0 commit comments

Comments
 (0)