Skip to content

Commit 6a206d8

Browse files
committed
Fix infinite loop when painting grid with bad parameters
Credit to @m-kuhn Cherry-picked from 4876c65
1 parent 2037c34 commit 6a206d8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/core/composer/qgscomposermapgrid.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,6 +1644,9 @@ int QgsComposerMapGrid::xGridLinesCRSTransform( const QgsRectangle& bbox, const
16441644
step = ( maxX + 360.0 - minX ) / 20;
16451645
}
16461646

1647+
if ( step == 0 )
1648+
return 1;
1649+
16471650
int gridLineCount = 0;
16481651
while ( currentLevel >= bbox.yMinimum() && gridLineCount < MAX_GRID_LINES )
16491652
{
@@ -1707,6 +1710,9 @@ int QgsComposerMapGrid::yGridLinesCRSTransform( const QgsRectangle& bbox, const
17071710
double maxY = bbox.yMaximum();
17081711
double step = ( maxY - minY ) / 20;
17091712

1713+
if ( step == 0 )
1714+
return 1;
1715+
17101716
bool crosses180 = false;
17111717
bool crossed180 = false;
17121718
if ( mCRS.geographicFlag() && ( bbox.xMinimum() > bbox.xMaximum() ) )

0 commit comments

Comments
 (0)