Skip to content

Commit 2ecf0fe

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 c77e393 commit 2ecf0fe

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed
 

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3497,9 +3497,19 @@ namespace QgsWms
34973497
QStringList _result;
34983498
if ( mLayerGroups.contains( name ) )
34993499
{
3500-
for ( const auto &l : mLayerGroups[ name ] )
3500+
const auto &layers { mLayerGroups[ name ] };
3501+
for ( const auto &l : layers )
35013502
{
3502-
_result.append( findLeaves( l->shortName().isEmpty() ? l->name() : l->shortName() ) );
3503+
const auto nick { layerNickname( *l ) };
3504+
// This handles the case for root (fake) group
3505+
if ( mLayerGroups.contains( nick ) )
3506+
{
3507+
_result.append( name );
3508+
}
3509+
else
3510+
{
3511+
_result.append( findLeaves( nick ) );
3512+
}
35033513
}
35043514
}
35053515
else
@@ -3508,7 +3518,8 @@ namespace QgsWms
35083518
}
35093519
return _result;
35103520
};
3511-
for ( const auto &name : mWmsParameters.queryLayersNickname() )
3521+
const auto constNicks { mWmsParameters.queryLayersNickname() };
3522+
for ( const auto &name : constNicks )
35123523
{
35133524
result.append( findLeaves( name ) );
35143525
}

0 commit comments

Comments
 (0)
Please sign in to comment.