diff --git a/src/qwt_plot_axis.cpp b/src/qwt_plot_axis.cpp index a49882fa..523f5edd 100644 --- a/src/qwt_plot_axis.cpp +++ b/src/qwt_plot_axis.cpp @@ -770,14 +770,14 @@ void QwtPlot::updateAxes() { const QRectF rect = item->boundingRect(); - if ( rect.width() >= 0.0 ) + if ( isAxisValid( item->xAxis()) && rect.width() >= 0.0 ) { const QwtAxisId xAxis = item->xAxis(); boundingIntervals[ xAxis.pos ][ xAxis.id ] |= QwtInterval( rect.left(), rect.right() ); } - if ( rect.height() >= 0.0 ) + if ( isAxisValid( item->yAxis()) && rect.height() >= 0.0 ) { const QwtAxisId yAxis = item->yAxis(); boundingIntervals[ yAxis.pos ][ yAxis.id ] |= @@ -831,7 +831,8 @@ void QwtPlot::updateAxes() for ( it = itmList.begin(); it != itmList.end(); ++it ) { QwtPlotItem* item = *it; - if ( item->testItemInterest( QwtPlotItem::ScaleInterest ) ) + if ( item->testItemInterest( QwtPlotItem::ScaleInterest ) && + isAxisValid( item->xAxis() ) && isAxisValid( item->yAxis() ) ) { item->updateScaleDiv( axisScaleDiv( item->xAxis() ), axisScaleDiv( item->yAxis() ) ); diff --git a/src/qwt_plot_curve.cpp b/src/qwt_plot_curve.cpp index 7abd4e4b..c7ddddf2 100644 --- a/src/qwt_plot_curve.cpp +++ b/src/qwt_plot_curve.cpp @@ -1055,6 +1055,9 @@ int QwtPlotCurve::closestPoint( const QPointF& pos, double* dist ) const if ( plot() == NULL || numSamples <= 0 ) return -1; + if ( !plot()->isAxisValid( xAxis() ) || !plot()->isAxisValid( yAxis() ) ) + return -1; + const QwtSeriesData< QPointF >* series = data(); const QwtScaleMap xMap = plot()->canvasMap( xAxis() );