Skip to content

Commit 4876c65

Browse files
committedJun 26, 2015
Fix infinite loop when painting grid with bad parameters
Credit to @m-kuhn
1 parent 9170b99 commit 4876c65

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
@@ -1651,6 +1651,9 @@ int QgsComposerMapGrid::xGridLinesCRSTransform( const QgsRectangle& bbox, const
16511651
step = ( maxX + 360.0 - minX ) / 20;
16521652
}
16531653

1654+
if ( step == 0 )
1655+
return 1;
1656+
16541657
int gridLineCount = 0;
16551658
while ( currentLevel >= bbox.yMinimum() && gridLineCount < MAX_GRID_LINES )
16561659
{
@@ -1714,6 +1717,9 @@ int QgsComposerMapGrid::yGridLinesCRSTransform( const QgsRectangle& bbox, const
17141717
double maxY = bbox.yMaximum();
17151718
double step = ( maxY - minY ) / 20;
17161719

1720+
if ( step == 0 )
1721+
return 1;
1722+
17171723
bool crosses180 = false;
17181724
bool crossed180 = false;
17191725
if ( mCRS.geographicFlag() && ( bbox.xMinimum() > bbox.xMaximum() ) )

0 commit comments

Comments
 (0)
Please sign in to comment.