Skip to content

Commit

Permalink
Catch some reprojection exceptions during raster rendering
Browse files Browse the repository at this point in the history
Fixes #32301
  • Loading branch information
nyalldawson committed Oct 25, 2019
1 parent 6c816b4 commit 40ac393
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/core/raster/qgsrasterprojector.cpp
Expand Up @@ -473,7 +473,14 @@ bool ProjectorData::preciseSrcRowCol( int destRow, int destCol, int *srcRow, int

if ( mInverseCt.isValid() )
{
mInverseCt.transformInPlace( x, y, z );
try
{
mInverseCt.transformInPlace( x, y, z );
}
catch ( QgsCsException & )
{
return false;
}
}

#ifdef QGISDEBUG
Expand Down Expand Up @@ -911,14 +918,21 @@ bool QgsRasterProjector::extentSize( const QgsCoordinateTransform &ct,
{
double y = srcExtent.yMinimum() + j * srcYStep;
QgsRectangle srcRectangle( x - srcXRes / 2, y - srcYRes / 2, x + srcXRes / 2, y + srcYRes / 2 );
QgsRectangle destRectangle = ct.transformBoundingBox( srcRectangle );
if ( destRectangle.width() > 0 )
try
{
destXRes = std::min( destXRes, destRectangle.width() );
QgsRectangle destRectangle = ct.transformBoundingBox( srcRectangle );
if ( destRectangle.width() > 0 )
{
destXRes = std::min( destXRes, destRectangle.width() );
}
if ( destRectangle.height() > 0 )
{
destYRes = std::min( destYRes, destRectangle.height() );
}
}
if ( destRectangle.height() > 0 )
catch ( QgsCsException & )
{
destYRes = std::min( destYRes, destRectangle.height() );

}
}
}
Expand Down

0 comments on commit 40ac393

Please sign in to comment.