Kaydet (Commit) a08f0aa2 authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1302609 Division or modulo by zero

Change-Id: Ia578a948b776c15372d3940b350f20048bb6124c
üst 1abbba1d
...@@ -606,9 +606,9 @@ void SvxStyleBox_Impl::UserDrawEntry(const UserDrawEvent& rUDEvt, const OUString ...@@ -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) 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) if (nItem == 0 || nItem == GetEntryCount() - 1)
{ {
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(); m_pButtons[nId]->Hide();
} }
...@@ -735,14 +735,12 @@ void SvxStyleBox_Impl::SetupEntry(sal_uInt16 nItem, const Rectangle& rRect, Outp ...@@ -735,14 +735,12 @@ void SvxStyleBox_Impl::SetupEntry(sal_uInt16 nItem, const Rectangle& rRect, Outp
// handle the push-button // handle the push-button
if (bIsNotSelected) 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(); m_pButtons[nId]->Hide();
} }
else else
{ {
unsigned int nId = (rRect.getY() / rRect.GetHeight()); if (nId < MAX_STYLES_ENTRIES)
if(nId < MAX_STYLES_ENTRIES)
{ {
if(m_pButtons[nId] == nullptr) if(m_pButtons[nId] == nullptr)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment