diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-05-30 21:22:21 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-06-01 17:41:20 +0100 |
commit | a08f0aa2857f4a5342cedf2038488fc98fb716fb (patch) | |
tree | bb225ee0bb07fb907f34e575ea219e4b51357fbd /svx | |
parent | 1abbba1d0980786b4bded6961a12da494cb93806 (diff) |
coverity#1302609 Division or modulo by zero
Change-Id: Ia578a948b776c15372d3940b350f20048bb6124c
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 47410965edd1..5fc515fcc42f 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -606,9 +606,9 @@ void SvxStyleBox_Impl::UserDrawEntry(const UserDrawEvent& rUDEvt, const OUString void SvxStyleBox_Impl::SetupEntry(sal_uInt16 nItem, const Rectangle& rRect, OutputDevice* pDevice, const OUString& rStyleName, bool bIsNotSelected) { + unsigned int nId = rRect.GetHeight() != 0 ? (rRect.getY() / rRect.GetHeight()) : MAX_STYLES_ENTRIES; if (nItem == 0 || nItem == GetEntryCount() - 1) { - unsigned int nId = (rRect.getY() / rRect.GetHeight()); if(nId < MAX_STYLES_ENTRIES && m_pButtons[nId]) m_pButtons[nId]->Hide(); } @@ -735,14 +735,12 @@ void SvxStyleBox_Impl::SetupEntry(sal_uInt16 nItem, const Rectangle& rRect, Outp // handle the push-button if (bIsNotSelected) { - unsigned int nId = (rRect.getY() / rRect.GetHeight()); - if(nId < MAX_STYLES_ENTRIES && m_pButtons[nId]) + if (nId < MAX_STYLES_ENTRIES && m_pButtons[nId]) m_pButtons[nId]->Hide(); } else { - unsigned int nId = (rRect.getY() / rRect.GetHeight()); - if(nId < MAX_STYLES_ENTRIES) + if (nId < MAX_STYLES_ENTRIES) { if(m_pButtons[nId] == nullptr) { |