Skip to content

Commit

Permalink
[BUGFIX] QGIS Server segfault if layer extent is null
Browse files Browse the repository at this point in the history
  • Loading branch information
rldhont committed Apr 20, 2016
1 parent d381043 commit 0ac299a
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/server/qgsconfigparserutils.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -92,8 +92,12 @@ void QgsConfigParserUtils::appendLayerBoundingBoxes( QDomElement& layerElem, QDo
//Ex_GeographicBoundingBox //Ex_GeographicBoundingBox
QDomElement ExGeoBBoxElement; QDomElement ExGeoBBoxElement;
//transform the layers native CRS into WGS84 //transform the layers native CRS into WGS84
QgsCoordinateTransform exGeoTransform( layerCRS, wgs84 ); QgsRectangle wgs84BoundingRect;
QgsRectangle wgs84BoundingRect = exGeoTransform.transformBoundingBox( layerExtent ); if ( !layerExtent.isNull() )
{
QgsCoordinateTransform exGeoTransform( layerCRS, wgs84 );
wgs84BoundingRect = exGeoTransform.transformBoundingBox( layerExtent );
}
if ( version == "1.1.1" ) // WMS Version 1.1.1 if ( version == "1.1.1" ) // WMS Version 1.1.1
{ {
ExGeoBBoxElement = doc.createElement( "LatLonBoundingBox" ); ExGeoBBoxElement = doc.createElement( "LatLonBoundingBox" );
Expand Down Expand Up @@ -185,8 +189,12 @@ void QgsConfigParserUtils::appendLayerBoundingBox( QDomElement& layerElem, QDomD
const QgsCoordinateReferenceSystem& crs = QgsCRSCache::instance()->crsByAuthId( crsText ); const QgsCoordinateReferenceSystem& crs = QgsCRSCache::instance()->crsByAuthId( crsText );


//transform the layers native CRS into CRS //transform the layers native CRS into CRS
QgsCoordinateTransform crsTransform( layerCRS, crs ); QgsRectangle crsExtent;
QgsRectangle crsExtent = crsTransform.transformBoundingBox( layerExtent ); if ( !layerExtent.isNull() )
{
QgsCoordinateTransform crsTransform( layerCRS, crs );
crsExtent = crsTransform.transformBoundingBox( layerExtent );
}


//BoundingBox element //BoundingBox element
QDomElement bBoxElement = doc.createElement( "BoundingBox" ); QDomElement bBoxElement = doc.createElement( "BoundingBox" );
Expand Down

0 comments on commit 0ac299a

Please sign in to comment.