diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-03-02 11:54:26 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-03-02 20:08:15 +0000 |
commit | 0f48aba07adee6253c4abd31329f11d485e38139 (patch) | |
tree | aa9a90b7b661111eddd0a0584ab462224dad4781 /extensions | |
parent | e6ba4db7f0fd02cf875e7e9cfcf3bbfe05676b9b (diff) |
coverity#704634 Dereference after null check
Change-Id: Id6e4e71a9d261734d01de72f81e2df0f7fbad475
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/scanner/grid.cxx | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/extensions/source/scanner/grid.cxx b/extensions/source/scanner/grid.cxx index 3bcabb54be66..5762bb593010 100644 --- a/extensions/source/scanner/grid.cxx +++ b/extensions/source/scanner/grid.cxx @@ -563,27 +563,30 @@ IMPL_LINK( GridWindow, ClickButtonHdl, Button*, pButton ) break; } - for(sal_uInt32 i(0L); i < m_aHandles.size(); i++) + if (m_pNewYValues) { - // find nearest xvalue - double x, y; - transform( m_aHandles[i].maPos, x, y ); - int nIndex = 0; - double delta = std::fabs( x-m_pXValues[0] ); - for( int n = 1; n < m_nValues; n++ ) + for(sal_uInt32 i(0L); i < m_aHandles.size(); i++) { - if( delta > std::fabs( x - m_pXValues[ n ] ) ) + // find nearest xvalue + double x, y; + transform( m_aHandles[i].maPos, x, y ); + int nIndex = 0; + double delta = std::fabs( x-m_pXValues[0] ); + for( int n = 1; n < m_nValues; n++ ) { - delta = std::fabs( x - m_pXValues[ n ] ); - nIndex = n; + if( delta > std::fabs( x - m_pXValues[ n ] ) ) + { + delta = std::fabs( x - m_pXValues[ n ] ); + nIndex = n; + } } + if( 0 == i ) + m_aHandles[i].maPos = transform( m_fMinX, m_pNewYValues[ nIndex ] ); + else if( m_aHandles.size() - 1L == i ) + m_aHandles[i].maPos = transform( m_fMaxX, m_pNewYValues[ nIndex ] ); + else + m_aHandles[i].maPos = transform( m_pXValues[ nIndex ], m_pNewYValues[ nIndex ] ); } - if( 0 == i ) - m_aHandles[i].maPos = transform( m_fMinX, m_pNewYValues[ nIndex ] ); - else if( m_aHandles.size() - 1L == i ) - m_aHandles[i].maPos = transform( m_fMaxX, m_pNewYValues[ nIndex ] ); - else - m_aHandles[i].maPos = transform( m_pXValues[ nIndex ], m_pNewYValues[ nIndex ] ); } Invalidate( m_aGridArea ); |