From cdbfbd0f7c3ed3bd3235f97197d279c41913245b Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 30 Oct 2014 09:21:40 +0000 Subject: coverity#735608 Division or modulo by float zero and coverity#735607 Division or modulo by float zero Change-Id: Iceeab702e183d291d7b1b6ded9113d1a15163c94 --- extensions/source/scanner/grid.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'extensions') diff --git a/extensions/source/scanner/grid.cxx b/extensions/source/scanner/grid.cxx index 4956c3fe6566..44143f555509 100644 --- a/extensions/source/scanner/grid.cxx +++ b/extensions/source/scanner/grid.cxx @@ -306,8 +306,12 @@ Point GridWindow::transform( double x, double y ) void GridWindow::transform( const Point& rOriginal, double& x, double& y ) { - x = ( rOriginal.X() - m_aGridArea.Left() ) * (m_fMaxX - m_fMinX) / (double)m_aGridArea.GetWidth() + m_fMinX; - y = ( m_aGridArea.Bottom() - rOriginal.Y() ) * (m_fMaxY - m_fMinY) / (double)m_aGridArea.GetHeight() + m_fMinY; + const long nWidth = m_aGridArea.GetWidth(); + const long nHeight = m_aGridArea.GetHeight(); + if (!nWidth || nHeight) + return; + x = ( rOriginal.X() - m_aGridArea.Left() ) * (m_fMaxX - m_fMinX) / (double)nWidth + m_fMinX; + y = ( m_aGridArea.Bottom() - rOriginal.Y() ) * (m_fMaxY - m_fMinY) / (double)nHeight + m_fMinY; } void GridWindow::drawLine( double x1, double y1, double x2, double y2 ) -- cgit