Skip to content

Commit 8be42a0

Browse files
committed
Followup c04a540
1 parent c04a540 commit 8be42a0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/core/composer/qgscomposermapgrid.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,8 @@ int QgsComposerMapGrid::xGridLinesCRSTransform( const QgsRectangle& bbox, const
970970
double maxX = bbox.xMaximum();
971971
double step = ( maxX - minX ) / 20;
972972

973-
while ( currentLevel >= bbox.yMinimum() )
973+
int gridLineCount = 0;
974+
while ( currentLevel >= bbox.yMinimum() && gridLineCount < MAX_GRID_LINES )
974975
{
975976
QPolygonF gridLine;
976977
double currentX = minX;
@@ -991,6 +992,7 @@ int QgsComposerMapGrid::xGridLinesCRSTransform( const QgsRectangle& bbox, const
991992
if ( gridLine.size() > 0 )
992993
{
993994
lines.append( qMakePair( currentLevel, gridLine ) );
995+
gridLineCount++;
994996
}
995997
currentLevel -= mGridIntervalY;
996998
}
@@ -1013,7 +1015,8 @@ int QgsComposerMapGrid::yGridLinesCRSTransform( const QgsRectangle& bbox, const
10131015
double maxY = bbox.yMaximum();
10141016
double step = ( maxY - minY ) / 20;
10151017

1016-
while ( currentLevel <= bbox.xMaximum() )
1018+
int gridLineCount = 0;
1019+
while ( currentLevel <= bbox.xMaximum() && gridLineCount < MAX_GRID_LINES )
10171020
{
10181021
QPolygonF gridLine;
10191022
double currentY = minY;
@@ -1035,6 +1038,7 @@ int QgsComposerMapGrid::yGridLinesCRSTransform( const QgsRectangle& bbox, const
10351038
if ( gridLine.size() > 0 )
10361039
{
10371040
lines.append( qMakePair( currentLevel, gridLine ) );
1041+
gridLineCount++;
10381042
}
10391043
currentLevel += mGridIntervalX;
10401044
}

0 commit comments

Comments
 (0)