Skip to content

Commit

Permalink
Fix infinite loop when painting grid with bad parameters
Browse files Browse the repository at this point in the history
Credit to @m-kuhn

Cherry-picked from 4876c65
  • Loading branch information
nyalldawson committed Jul 9, 2015
1 parent 2037c34 commit 6a206d8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/core/composer/qgscomposermapgrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1644,6 +1644,9 @@ int QgsComposerMapGrid::xGridLinesCRSTransform( const QgsRectangle& bbox, const
step = ( maxX + 360.0 - minX ) / 20;
}

if ( step == 0 )
return 1;

int gridLineCount = 0;
while ( currentLevel >= bbox.yMinimum() && gridLineCount < MAX_GRID_LINES )
{
Expand Down Expand Up @@ -1707,6 +1710,9 @@ int QgsComposerMapGrid::yGridLinesCRSTransform( const QgsRectangle& bbox, const
double maxY = bbox.yMaximum();
double step = ( maxY - minY ) / 20;

if ( step == 0 )
return 1;

bool crosses180 = false;
bool crossed180 = false;
if ( mCRS.geographicFlag() && ( bbox.xMinimum() > bbox.xMaximum() ) )
Expand Down

0 comments on commit 6a206d8

Please sign in to comment.