diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-05-11 15:41:34 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-05-12 13:30:57 +0200 |
commit | 86d7984cac6687edd6be2a86fae49c0a10d14627 (patch) | |
tree | 626a0fc87f672d25a6c9d86d5da8dcf17e393857 /sw | |
parent | 6cbb674e63e6f94f207d59237c623480fea8c4cc (diff) |
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>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/misc/pggrid.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx index 0a1185e45765..24b8c06aaef6 100644 --- a/sw/source/ui/misc/pggrid.cxx +++ b/sw/source/ui/misc/pggrid.cxx @@ -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() ); |