coverity#1430102 Division by zero

Change-Id: Iae44c89c4af70e3e5b19137ee08ca566c7a04fb7
Reviewed-on: https://gerrit.libreoffice.org/54141
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara
2018-05-11 15:41:34 +01:00
parent 6cbb674e63
commit 86d7984cac

View File

@@ -405,9 +405,11 @@ IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, SpinField&, rField, void)
}
else//in normal mode
{
if(m_pLinesPerPageNF == &rField)
if (m_pLinesPerPageNF == &rField)
{
long nHeight = static_cast< sal_Int32 >(m_aPageSize.Height() / m_pLinesPerPageNF->GetValue());
auto nValue = m_pLinesPerPageNF->GetValue();
assert(nValue && "div-by-zero");
long nHeight = static_cast< sal_Int32 >(m_aPageSize.Height() / nValue);
m_pTextSizeMF->SetValue(m_pTextSizeMF->Normalize(nHeight), FUNIT_TWIP);
m_pRubySizeMF->SetValue(0, FUNIT_TWIP);
SetLinesOrCharsRanges( *m_pLinesRangeFT , m_pLinesPerPageNF->GetMax() );