diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-10-30 09:21:40 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-10-30 09:21:40 +0000 |
commit | cdbfbd0f7c3ed3bd3235f97197d279c41913245b (patch) | |
tree | 7a929bd3c92cbebe467df21609dc137d478fd2bb /extensions | |
parent | restore using rtl for OSL_DEBUG_LEVEL > 1 (diff) | |
download | core-cdbfbd0f7c3ed3bd3235f97197d279c41913245b.tar.gz core-cdbfbd0f7c3ed3bd3235f97197d279c41913245b.zip |
coverity#735608 Division or modulo by float zero
and
coverity#735607 Division or modulo by float zero
Change-Id: Iceeab702e183d291d7b1b6ded9113d1a15163c94
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/scanner/grid.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
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 ) |