summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-10-16 20:44:31 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-10-17 14:46:27 +0100
commite1bc0f42fa5d474ba153672ee33f2ddc004dd15b (patch)
treeb72d2f4aad71c4f68a9b016acdd17bd45d8b4160 /dbaccess
parente8d848543ee6b7e4696381ececc476d3522b3614 (diff)
coverity#1327443 Division or modulo by zero
Change-Id: Iefddcc2d66e77e3698dec9930898f63e0b7902f6
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/ui/dlg/paramdialog.cxx34
1 files changed, 18 insertions, 16 deletions
diff --git a/dbaccess/source/ui/dlg/paramdialog.cxx b/dbaccess/source/ui/dlg/paramdialog.cxx
index ef8f0cc43a28..7a3769df11d1 100644
--- a/dbaccess/source/ui/dlg/paramdialog.cxx
+++ b/dbaccess/source/ui/dlg/paramdialog.cxx
@@ -263,25 +263,27 @@ namespace dbaui
}
else if (m_pTravelNext == pButton)
{
- sal_Int32 nCurrent = m_pAllParams->GetSelectEntryPos();
- sal_Int32 nCount = m_pAllParams->GetEntryCount();
- OSL_ENSURE(static_cast<size_t>(nCount) == m_aVisitedParams.size(), "OParameterDialog::OnButtonClicked : inconsistent lists !");
+ if (sal_Int32 nCount = m_pAllParams->GetEntryCount())
+ {
+ sal_Int32 nCurrent = m_pAllParams->GetSelectEntryPos();
+ OSL_ENSURE(static_cast<size_t>(nCount) == m_aVisitedParams.size(), "OParameterDialog::OnButtonClicked : inconsistent lists !");
- // search the next entry in list we haven't visited yet
- sal_Int32 nNext = (nCurrent + 1) % nCount;
- while ((nNext != nCurrent) && ( m_aVisitedParams[nNext] & EF_VISITED ))
- nNext = (nNext + 1) % nCount;
+ // search the next entry in list we haven't visited yet
+ sal_Int32 nNext = (nCurrent + 1) % nCount;
+ while ((nNext != nCurrent) && ( m_aVisitedParams[nNext] & EF_VISITED ))
+ nNext = (nNext + 1) % nCount;
- if ( m_aVisitedParams[nNext] & EF_VISITED )
- // there is no such "not visited yet" entry -> simply take the next one
- nNext = (nCurrent + 1) % nCount;
+ if ( m_aVisitedParams[nNext] & EF_VISITED )
+ // there is no such "not visited yet" entry -> simply take the next one
+ nNext = (nCurrent + 1) % nCount;
- m_pAllParams->SelectEntryPos(nNext);
- OnEntrySelected();
- m_bNeedErrorOnCurrent = true;
- // we're are out of the complex web :) of direct and indirect calls to OnValueLoseFocus now,
- // so the next time it is called we need an error message, again ....
- // (TODO : there surely are better solutions for this ...)
+ m_pAllParams->SelectEntryPos(nNext);
+ OnEntrySelected();
+ m_bNeedErrorOnCurrent = true;
+ // we're are out of the complex web :) of direct and indirect calls to OnValueLoseFocus now,
+ // so the next time it is called we need an error message, again ....
+ // (TODO : there surely are better solutions for this ...)
+ }
}
}