Skip to content
Permalink
Browse files

Fix uncaught exception when calculating full extent (fixes #40683)

  • Loading branch information
nyalldawson committed Dec 21, 2020
1 parent e2c5878 commit b331c79592ad8073ab1e29ce6ea9cd92b00edc73
Showing with 10 additions and 3 deletions.
  1. +10 −3 src/core/qgsprojectviewsettings.cpp
@@ -101,10 +101,17 @@ QgsReferencedRectangle QgsProjectViewSettings::fullExtent() const
// layer. The extent must be projected to the canvas CS
QgsCoordinateTransform ct( it.value()->crs(), mProject->crs(), mProject->transformContext() );
ct.setBallparkTransformsAreAppropriate( true );
const QgsRectangle extent = ct.transformBoundingBox( it.value()->extent() );
try
{
const QgsRectangle extent = ct.transformBoundingBox( it.value()->extent() );

QgsDebugMsgLevel( "Output extent: " + extent.toString(), 5 );
fullExtent.combineExtentWith( extent );
QgsDebugMsgLevel( "Output extent: " + extent.toString(), 5 );
fullExtent.combineExtentWith( extent );
}
catch ( QgsCsException & )
{
QgsDebugMsg( QStringLiteral( "Could not reproject layer extent" ) );
}
}

if ( fullExtent.width() == 0.0 || fullExtent.height() == 0.0 )

0 comments on commit b331c79

Please sign in to comment.
You can’t perform that action at this time.