Skip to content

Commit 0b0e95e

Browse files
authored
Merge pull request #9730 from elpaso/fix-fake-group-3_6
Fix crash when project has no groups and project OWS name equals to
2 parents c77e393 + 2ecf0fe commit 0b0e95e

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/server/services/wms/qgswmsrenderer.cpp

+14-3
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)