Skip to content

Commit c1cec89

Browse files
committedApr 5, 2019
Fix crash when project has no groups and project OWS name equals to
... first layer short name Manually backported from master
1 parent 260e9ad commit c1cec89

File tree

4 files changed

+83
-13
lines changed

4 files changed

+83
-13
lines changed
 

‎src/server/services/wms/qgswmsrenderer.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3182,9 +3182,18 @@ namespace QgsWms
31823182
QStringList _result;
31833183
if ( mLayerGroups.contains( name ) )
31843184
{
3185-
for ( const auto &l : mLayerGroups[ name ] )
3185+
const auto &layers { mLayerGroups[ name ] };
3186+
for ( const auto &l : layers )
31863187
{
3187-
_result.append( findLeaves( l->shortName().isEmpty() ? l->name() : l->shortName() ) );
3188+
const auto nick { layerNickname( *l ) };
3189+
if ( mLayerGroups.contains( nick ) )
3190+
{
3191+
_result.append( name );
3192+
}
3193+
else
3194+
{
3195+
_result.append( findLeaves( nick ) );
3196+
}
31883197
}
31893198
}
31903199
else
@@ -3193,7 +3202,8 @@ namespace QgsWms
31933202
}
31943203
return _result;
31953204
};
3196-
for ( const auto &name : mWmsParameters.queryLayersNickname() )
3205+
const auto constNicks { mWmsParameters.queryLayersNickname() };
3206+
for ( const auto &name : constNicks )
31973207
{
31983208
result.append( findLeaves( name ) );
31993209
}

‎tests/testdata/qgis_server/getprojectsettings.txt

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
Response:
21
*****
3-
42
Content-Type: text/xml; charset=utf-8
3+
54
<?xml version="1.0" encoding="utf-8"?>
65
<WMS_Capabilities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:qgs="http://www.qgis.org/wms" xmlns="http://www.opengis.net/wms" xsi:schemaLocation="http://www.opengis.net/wms http://schemas.opengis.net/wms/1.3.0/capabilities_1_3_0.xsd http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/sld_capabilities.xsd https://www.qgis.org/?*****" version="1.3.0" xmlns:sld="http://www.opengis.net/sld">
76
<Service>
@@ -132,7 +131,7 @@ Content-Type: text/xml; charset=utf-8
132131
<southBoundLatitude>44.9012</southBoundLatitude>
133132
<northBoundLatitude>44.9016</northBoundLatitude>
134133
</EX_GeographicBoundingBox>
135-
<BoundingBox maxy="5.60604e+6" maxx="913283" miny="5.60599e+6" CRS="EPSG:3857" minx="913171"/>
134+
<BoundingBox maxy="5.60604e+06" maxx="913283" miny="5.60599e+06" CRS="EPSG:3857" minx="913171"/>
136135
<BoundingBox maxy="8.20416" maxx="44.9016" miny="8.20315" CRS="EPSG:4326" minx="44.9012"/>
137136
<Name>QGIS Test Project</Name>
138137
<KeywordList>
@@ -152,7 +151,7 @@ Content-Type: text/xml; charset=utf-8
152151
<southBoundLatitude>44.9014</southBoundLatitude>
153152
<northBoundLatitude>44.9015</northBoundLatitude>
154153
</EX_GeographicBoundingBox>
155-
<BoundingBox maxy="5.60603e+6" maxx="913215" miny="5.60601e+6" CRS="EPSG:3857" minx="913205"/>
154+
<BoundingBox maxy="5.60603e+06" maxx="913215" miny="5.60601e+06" CRS="EPSG:3857" minx="913205"/>
156155
<BoundingBox maxy="8.20355" maxx="44.9015" miny="8.20346" CRS="EPSG:4326" minx="44.9014"/>
157156
<Style>
158157
<Name>default</Name>
@@ -182,7 +181,7 @@ Content-Type: text/xml; charset=utf-8
182181
<southBoundLatitude>44.9014</southBoundLatitude>
183182
<northBoundLatitude>44.9015</northBoundLatitude>
184183
</EX_GeographicBoundingBox>
185-
<BoundingBox maxy="5.60603e+6" maxx="913215" miny="5.60601e+6" CRS="EPSG:3857" minx="913205"/>
184+
<BoundingBox maxy="5.60603e+06" maxx="913215" miny="5.60601e+06" CRS="EPSG:3857" minx="913205"/>
186185
<BoundingBox maxy="8.20355" maxx="44.9015" miny="8.20346" CRS="EPSG:4326" minx="44.9014"/>
187186
<Style>
188187
<Name>default</Name>
@@ -212,7 +211,7 @@ Content-Type: text/xml; charset=utf-8
212211
<southBoundLatitude>44.9014</southBoundLatitude>
213212
<northBoundLatitude>44.9015</northBoundLatitude>
214213
</EX_GeographicBoundingBox>
215-
<BoundingBox maxy="5.60603e+6" maxx="913215" miny="5.60601e+6" CRS="EPSG:3857" minx="913205"/>
214+
<BoundingBox maxy="5.60603e+06" maxx="913215" miny="5.60601e+06" CRS="EPSG:3857" minx="913205"/>
216215
<BoundingBox maxy="8.20355" maxx="44.9015" miny="8.20346" CRS="EPSG:4326" minx="44.9014"/>
217216
<TreeName>groupwithshortname</TreeName>
218217
<Layer geometryType="Point" queryable="1" displayField="id" visible="1">
@@ -227,7 +226,7 @@ Content-Type: text/xml; charset=utf-8
227226
<southBoundLatitude>44.9014</southBoundLatitude>
228227
<northBoundLatitude>44.9015</northBoundLatitude>
229228
</EX_GeographicBoundingBox>
230-
<BoundingBox maxy="5.60603e+6" maxx="913215" miny="5.60601e+6" CRS="EPSG:3857" minx="913205"/>
229+
<BoundingBox maxy="5.60603e+06" maxx="913215" miny="5.60601e+06" CRS="EPSG:3857" minx="913205"/>
231230
<BoundingBox maxy="8.20355" maxx="44.9015" miny="8.20346" CRS="EPSG:4326" minx="44.9014"/>
232231
<Style>
233232
<Name>default</Name>
@@ -257,7 +256,7 @@ Content-Type: text/xml; charset=utf-8
257256
<southBoundLatitude>44.9014</southBoundLatitude>
258257
<northBoundLatitude>44.9015</northBoundLatitude>
259258
</EX_GeographicBoundingBox>
260-
<BoundingBox maxy="5.60603e+6" maxx="913215" miny="5.60601e+6" CRS="EPSG:3857" minx="913205"/>
259+
<BoundingBox maxy="5.60603e+06" maxx="913215" miny="5.60601e+06" CRS="EPSG:3857" minx="913205"/>
261260
<BoundingBox maxy="8.20355" maxx="44.9015" miny="8.20346" CRS="EPSG:4326" minx="44.9014"/>
262261
<TreeName>groupwithoutshortname</TreeName>
263262
<Layer geometryType="Point" queryable="0" displayField="id" visible="1">
@@ -272,7 +271,7 @@ Content-Type: text/xml; charset=utf-8
272271
<southBoundLatitude>44.9014</southBoundLatitude>
273272
<northBoundLatitude>44.9015</northBoundLatitude>
274273
</EX_GeographicBoundingBox>
275-
<BoundingBox maxy="5.60603e+6" maxx="913215" miny="5.60601e+6" CRS="EPSG:3857" minx="913205"/>
274+
<BoundingBox maxy="5.60603e+06" maxx="913215" miny="5.60601e+06" CRS="EPSG:3857" minx="913205"/>
276275
<BoundingBox maxy="8.20355" maxx="44.9015" miny="8.20346" CRS="EPSG:4326" minx="44.9014"/>
277276
<Style>
278277
<Name>default</Name>
@@ -294,4 +293,3 @@ Content-Type: text/xml; charset=utf-8
294293
<LayerDrawingOrder>testlayer3,testlayer2,testlayer èé,layer_with_short_name</LayerDrawingOrder>
295294
</Capability>
296295
</WMS_Capabilities>
297-
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
*****
2+
Content-Type: text/plain; charset=utf-8
3+
4+
GetFeatureInfo results
5+
6+
Layer 'as_symbols'
7+
8+
Layer 'as-areas-short-name'
9+
Feature 18
10+
fid = '18'
11+
gid = '34'
12+
datum = '2013-06-11'
13+
bearbeiter = 'scholle-b'
14+
veranstaltung = ''
15+
beschriftung = ''
16+
name = ''
17+
flaechentyp = 'Schraffur'
18+
farbe = '255 0 0'
19+
schraff_width = '2'
20+
schraff_width_prt = '6.00'
21+
schraff_size = '10'
22+
schraff_size_prt = '30.00'
23+
schraff_winkel = '45'
24+
umrissfarbe = '0 0 0'
25+
umrisstyp = 'durchgezogen'
26+
umrissstaerke = '1'
27+
umrissstaerke_prt = '3.00'
28+
umfang = '758.4703'
29+
flaeche = '12879'
30+
bemerkung = ''
31+
last_change = '2013-06-11 10:03:45.52301+02'
32+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
*****
2+
Content-Type: text/plain; charset=utf-8
3+
4+
GetFeatureInfo results
5+
6+
Layer 'as-areas-short-name'
7+
Feature 18
8+
fid = '18'
9+
gid = '34'
10+
datum = '2013-06-11'
11+
bearbeiter = 'scholle-b'
12+
veranstaltung = ''
13+
beschriftung = ''
14+
name = ''
15+
flaechentyp = 'Schraffur'
16+
farbe = '255 0 0'
17+
schraff_width = '2'
18+
schraff_width_prt = '6.00'
19+
schraff_size = '10'
20+
schraff_size_prt = '30.00'
21+
schraff_winkel = '45'
22+
umrissfarbe = '0 0 0'
23+
umrisstyp = 'durchgezogen'
24+
umrissstaerke = '1'
25+
umrissstaerke_prt = '3.00'
26+
umfang = '758.4703'
27+
flaeche = '12879'
28+
bemerkung = ''
29+
last_change = '2013-06-11 10:03:45.52301+02'
30+

0 commit comments

Comments
 (0)
Please sign in to comment.