Skip to content

Commit

Permalink
Server: do not crash on broken tree
Browse files Browse the repository at this point in the history
Spotted on a broken project.
  • Loading branch information
elpaso committed Nov 30, 2020
1 parent 3b262f2 commit d84624c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/server/services/wms/qgswmsgetcapabilities.cpp
Expand Up @@ -2035,7 +2035,14 @@ namespace QgsWms
{
const auto treeLayer { static_cast<const QgsLayerTreeLayer *>( childNode ) };
const auto l { treeLayer->layer() };
return ! wmsRestrictedLayers.contains( l->name() ) && l->flags().testFlag( QgsMapLayer::Identifiable );
if ( l )
{
return ! wmsRestrictedLayers.contains( l->name() ) && l->flags().testFlag( QgsMapLayer::Identifiable );
}
else
{
QgsMessageLog::logMessage( QStringLiteral( "Broken/corrupted layer tree: check your project!" ), QStringLiteral( "Server" ), Qgis::MessageLevel::Warning );
}
}
return false;
}
Expand Down

0 comments on commit d84624c

Please sign in to comment.