diff --git a/common/widgets/mathplot.cpp b/common/widgets/mathplot.cpp index 946e1a4494..9d9d311832 100644 --- a/common/widgets/mathplot.cpp +++ b/common/widgets/mathplot.cpp @@ -1005,7 +1005,10 @@ void mpScaleY::recalculateTicks ( wxDC & dc, mpWindow & w ) double zeroOffset = 100000000.0; //printf("maxVVis %.3f\n", maxVvis); - while ( v < maxVvis ) + const int iterLimit = 1000; + int i = 0; + + while ( v < maxVvis && i < iterLimit) { m_tickValues.push_back(v); @@ -1016,6 +1019,12 @@ void mpScaleY::recalculateTicks ( wxDC & dc, mpWindow & w ) v+=bestStep; } + // something weird happened... + if ( i == iterLimit ) + { + m_tickValues.clear(); + } + if ( zeroOffset <= bestStep ) { for( double& t: m_tickValues ) @@ -3625,4 +3634,3 @@ double mpFXY::y2s(double y) const { return m_scaleY->TransformToPlot( y ); } -